clang-format: limit diff to 50 files to prevent exceding the maximum travis output...
authorLoïc Blot <nerzhul@users.noreply.github.com>
Sun, 26 Mar 2017 09:29:21 +0000 (11:29 +0200)
committerGitHub <noreply@github.com>
Sun, 26 Mar 2017 09:29:21 +0000 (11:29 +0200)
util/travis/script.sh

index 557822e1f1d83c7239888fbe61d07d85e49bf195..ab524b4b4176808ad4fe19218a0b8c33aff7164b 100755 (executable)
@@ -13,11 +13,18 @@ function perform_lint() {
                files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h' | egrep -v '^src/(gmp|lua|jsoncpp)/')"
        fi
 
+       local errorcount=0
        local fail=0
        for f in ${files_to_lint}; do
                d=$(diff -u "$f" <(${CLANG_FORMAT} "$f") || true)
                if ! [ -z "$d" ]; then
+                       ((errorcount++))
                        printf "The file %s is not compliant with the coding style:\n%s\n" "$f" "$d"
+                       if [ ${errorcount} -gt 50 ]; then
+                               printf "Too many errors encountered previously, this diff is hidden.\n"
+                       else
+                               printf "%s\n" "$d"
+                       fi
                        # Disable build failure at this moment as we need to have a complete MT source whitelist to check
                        fail=0
                fi