From fda6ef6ac6c150dd16aa95f84dacc7f4e12f5852 Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Wed, 29 Apr 2020 09:48:14 +0200 Subject: [PATCH] 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. --- dist/tools/uncrustify/uncrustify.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dist/tools/uncrustify/uncrustify.sh b/dist/tools/uncrustify/uncrustify.sh index d1efad07b3..13f1f7bb87 100755 --- a/dist/tools/uncrustify/uncrustify.sh +++ b/dist/tools/uncrustify/uncrustify.sh @@ -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!" }