mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
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
This commit is contained in:
parent
a9878a0da5
commit
4b05feaceb
2 changed files with 466 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue