rpm-ostree/ci/codestyle.sh
Colin Walters 8a172a2e05 rust: rustfmt(*) and (re)add a CI check for it
We haven't been consistent about doing this; I personally
think rustfmt is a big aggressive with the line wrapping
but eh, consistency is more important.

And heh so I tried to `git push --set-upstream cgwalters` and
that failed because there was an already extant `rustfmt`
branch from a while ago...looking at that code it got lost
in the CI refactoring - we're not running `build-check.sh`
at the moment.

Move the rustfmt bits into `codestyle.sh` which is closer
to where it should be anyways.
2020-04-08 02:52:30 +02:00

23 lines
497 B
Bash
Executable File

#!/bin/sh
set -euo pipefail
echo -n "Checking for tabs..."
(git grep -E '^ +' -- '*.[ch]' || true) > tabdamage.txt
if test -s tabdamage.txt; then
echo "Error: tabs in .[ch] files:"
cat tabdamage.txt
exit 1
fi
echo "ok"
echo -n "checking rustfmt..."
cd rust
for crate in $(find -iname Cargo.toml); do
if ! cargo fmt --manifest-path ${crate} -- --check; then
echo "cargo fmt failed; run: cd $(dirname ${crate}) && cargo fmt" 1>&2
exit 1
fi
done
cd ..
echo "ok"