1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-24 13:25:21 +02:00

LINT: Switch whitelist check from egrep to awk

Bonus: make CI happy with the last rules fix
This commit is contained in:
Loïc Blot
2017-04-06 16:03:29 +02:00
committed by Loic Blot
parent 88b9b9652a
commit 3a90b78a03
6 changed files with 12 additions and 7 deletions

View File

@@ -6,6 +6,7 @@ function perform_lint() {
else
CLANG_FORMAT=clang-format
fi
echo "LINT: Using binary $CLANG_FORMAT"
CLANG_FORMAT_WHITELIST="util/travis/clang-format-whitelist.txt"
if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then
@@ -22,10 +23,10 @@ function perform_lint() {
d=$(diff -u "$f" <(${CLANG_FORMAT} "$f") || true)
if ! [ -z "$d" ]; then
whitelisted=$(egrep -c "^${f}" "${CLANG_FORMAT_WHITELIST}")
whitelisted=$(awk '$1 == "'$f'" { print 1 }' "$CLANG_FORMAT_WHITELIST")
# If file is not whitelisted, mark a failure
if [ ${whitelisted} -eq 0 ]; then
if [ -z ${whitelisted} ]; then
errorcount=$((errorcount+1))
printf "The file %s is not compliant with the coding style" "$f"