clang-format: limit diff to 50 files to prevent exceding the maximum travis output (4MB) (#5455)

This commit is contained in:
Loïc Blot 2017-03-26 11:29:21 +02:00 committed by GitHub
parent 1139a18c3a
commit aa5549ecc3
1 changed files with 7 additions and 0 deletions

View File

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