Clang format: only show errors on non whitelisted files
authorLoic Blot <loic.blot@unix-experience.fr>
Thu, 6 Apr 2017 06:42:52 +0000 (08:42 +0200)
committerLoic Blot <loic.blot@unix-experience.fr>
Thu, 6 Apr 2017 06:42:52 +0000 (08:42 +0200)
util/travis/script.sh

index 4a12df5f61f4025874c7748f567efdce3d402a6c..44057352deb762d68fd8a6ea336a5165805cc8f3 100755 (executable)
@@ -22,19 +22,19 @@ function perform_lint() {
                d=$(diff -u "$f" <(${CLANG_FORMAT} "$f") || true)
 
                if ! [ -z "$d" ]; then
-                       errorcount=$((errorcount+1))
-
-                       printf "The file %s is not compliant with the coding style" "$f"
-                       if [ ${errorcount} -gt 50 ]; then
-                               printf "\nToo many errors encountered previously, this diff is hidden.\n"
-                       else
-                               printf ":\n%s\n" "$d"
-                       fi
-
                        whitelisted=$(egrep -c "^${f}" "${CLANG_FORMAT_WHITELIST}")
 
                        # If file is not whitelisted, mark a failure
                        if [ ${whitelisted} -eq 0 ]; then
+                               errorcount=$((errorcount+1))
+
+                               printf "The file %s is not compliant with the coding style" "$f"
+                               if [ ${errorcount} -gt 50 ]; then
+                                       printf "\nToo many errors encountered previously, this diff is hidden.\n"
+                               else
+                                       printf ":\n%s\n" "$d"
+                               fi
+
                                fail=1
                        fi
                fi