From 4b05feaceb38a2ab2063b8ff6e92d96393ad384e Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Mon, 27 Mar 2017 15:33:15 +0200 Subject: clang-format: add a whitelist (#5459) If file is in the whitelist, softfail, else hard failure Some files are not in whitelist and marked as normal: * src/content_mapnode.h * src/cguittfont/xCGUITTFont.cpp * src/gameparams.h * src/profiler.cpp --- util/travis/script.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'util/travis/script.sh') diff --git a/util/travis/script.sh b/util/travis/script.sh index 0e4f92eef..ef42916b0 100755 --- a/util/travis/script.sh +++ b/util/travis/script.sh @@ -6,6 +6,8 @@ needs_compile || exit 0 function perform_lint() { echo "Performing LINT..." CLANG_FORMAT=clang-format-3.9 + CLANG_FORMAT_WHITELIST="util/travis/clang-format-whitelist.txt" + if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then # Get list of every file modified in this pull request files_to_lint="$(git diff --name-only --diff-filter=ACMRTUXB $TRAVIS_COMMIT_RANGE | grep '^src/[^.]*[.]\(cpp\|h\)$' | egrep -v '^src/(gmp|lua|jsoncpp)/' || true)" @@ -28,8 +30,13 @@ function perform_lint() { else printf ":\n%s\n" "$d" fi - # Disable build failure at this moment as we need to have a complete MT source whitelist to check - fail=0 + + whitelisted=$(egrep -c "^${f}" "${CLANG_FORMAT_WHITELIST}") + + # If file is not whitelisted, mark a failure + if [ ${whitelisted} -eq 0 ]; then + fail=1 + fi fi done @@ -37,6 +44,8 @@ function perform_lint() { echo "LINT reports failure." exit 1 fi + + echo "LINT OK" } if [[ "$LINT" == "1" ]]; then -- cgit v1.2.3