dist/tools/uncrustify/uncrustify.sh: fix uncrustify check logic

Previously, uncrustify.sh would fail (report uncrustifying necessary) if
there was any output of uncrustify. Turns out uncrustify sometimes
outputs something.

This commit changes the logic to use uncrustify's output value as
indicator.

Also, adds printing which file causes the check to fail.
This commit is contained in:
Kaspar Schleiser 2020-04-29 09:48:14 +02:00
parent e531bdbcec
commit fda6ef6ac6

View File

@ -15,11 +15,12 @@ FILES=$(changed_files | grep -xf "$WHITELIST" | grep -xvf "$BLACKLIST")
check () {
for F in $FILES
do
OUT="$(uncrustify -c "$UNCRUSTIFY_CFG" -f "$RIOTBASE/$F" --check 2> /dev/null)"
if [ "$OUT" ] ; then
uncrustify -c "$UNCRUSTIFY_CFG" -f "$RIOTBASE/$F" \
--check > /dev/null 2>&1 || {
echo "file $F needs to be uncrustified."
echo "Please run 'dist/tools/uncrustify/uncrustify.sh'"
exit 1
fi
}
done
echo "All files are uncrustified!"
}