tools: whitespacecheck: use ignore file to easily add expressions

This commit is contained in:
Cenk Gündoğan 2020-08-04 13:11:05 +02:00
parent 4517e27837
commit f4e631ffdb
2 changed files with 4 additions and 3 deletions

View File

@ -6,7 +6,7 @@
# General Public License v2.1. See the file LICENSE in the top level # General Public License v2.1. See the file LICENSE in the top level
# directory for more details. # directory for more details.
NOVENDOR=":!*/vendor/*" IGNORE=`awk '{ printf ":!%s ", $0 }' $(dirname "$0")/ignore_list.txt`
# If no branch but an option is given, unset BRANCH. # If no branch but an option is given, unset BRANCH.
# Otherwise, consume this parameter. # Otherwise, consume this parameter.
@ -30,14 +30,14 @@ if [ -z "${BRANCH}" ]; then
fi fi
git -c core.whitespace="tab-in-indent,tabwidth=4" \ git -c core.whitespace="tab-in-indent,tabwidth=4" \
diff --check $(git merge-base ${BRANCH} HEAD) -- *.[ch] ${NOVENDOR} diff --check $(git merge-base ${BRANCH} HEAD) -- *.[ch] ${IGNORE}
RESULT=$? RESULT=$?
# Git regards any trailing white space except `\n` as an error so `\r` is # Git regards any trailing white space except `\n` as an error so `\r` is
# checked here, too # checked here, too
git -c core.whitespace="trailing-space" \ git -c core.whitespace="trailing-space" \
diff --check $(git merge-base ${BRANCH} HEAD) -- . ${NOVENDOR} diff --check $(git merge-base ${BRANCH} HEAD) -- . ${IGNORE}
if [ $? -ne 0 ] || [ $RESULT -ne 0 ] if [ $? -ne 0 ] || [ $RESULT -ne 0 ]
then then
echo "ERROR: This change introduces new whitespace errors" echo "ERROR: This change introduces new whitespace errors"

View File

@ -0,0 +1 @@
*/vendor/*