diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-03-27 15:33:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-27 15:33:15 +0200 |
commit | 4b05feaceb38a2ab2063b8ff6e92d96393ad384e (patch) | |
tree | 9443e73076bae78081300d6287066aad42701db5 /util/travis/script.sh | |
parent | a9878a0da56834eb23e3c05d505e5dbec4c81b88 (diff) | |
download | minetest-4b05feaceb38a2ab2063b8ff6e92d96393ad384e.tar.gz minetest-4b05feaceb38a2ab2063b8ff6e92d96393ad384e.tar.bz2 minetest-4b05feaceb38a2ab2063b8ff6e92d96393ad384e.zip |
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
Diffstat (limited to 'util/travis/script.sh')
-rwxr-xr-x | util/travis/script.sh | 13 |
1 files changed, 11 insertions, 2 deletions
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 |