From 54867864958262a57c60267df51c717a5bb8cc1d Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Wed, 30 May 2018 15:54:08 +0200 Subject: [PATCH] checkpatch: exclude util/crossgcc/patches These files are supposed to contain trailing whitespace due to the patch format. Also use the exclusion list in the pre-commit hook. Change-Id: I8816c05ea703964a332915a0675096836957b242 Signed-off-by: Patrick Georgi Reviewed-on: https://review.coreboot.org/26695 Reviewed-by: Nico Huber Reviewed-by: Martin Roth Tested-by: build bot (Jenkins) --- util/gitconfig/pre-commit | 2 +- util/lint/lint-007-checkpatch | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/util/gitconfig/pre-commit b/util/gitconfig/pre-commit index 2aed957df9..027eec0705 100755 --- a/util/gitconfig/pre-commit +++ b/util/gitconfig/pre-commit @@ -24,5 +24,5 @@ PATCHDIFF=$(git diff --cached --src-prefix=a/ --dst-prefix=b/) if printf "%s\n" "$PATCHDIFF" | grep -q "@@"; then echo echo "Running checkpatch" - printf "%s\n" "$PATCHDIFF" | util/lint/checkpatch.pl --no-signoff -q - + printf "%s\n" "$PATCHDIFF" | util/lint/lint-007-checkpatch diff fi diff --git a/util/lint/lint-007-checkpatch b/util/lint/lint-007-checkpatch index 2e451cb77d..34b933164c 100755 --- a/util/lint/lint-007-checkpatch +++ b/util/lint/lint-007-checkpatch @@ -21,13 +21,21 @@ INCLUDED_FILES='.*\.[ch]\|Kconfig.*$' EXCLUDED_DIRS="^payloads/libpayload/util/kconfig\|\ ^payloads/libpayload/curses/PDCurses\|\ +^util/crossgcc/patches\|\ ^util/kconfig\|\ ^src/vendorcode\|\ ^Documentation" -# Space separated list of directories to test +# default: test src and util if [ "$1" = "" ]; then INCLUDED_DIRS="src util" +# special mode: take diff from stdin, but exclude the dirs +elif [ "$1" = "diff" ]; then + args=$( echo $EXCLUDED_DIRS | \ + sed -e 's,\\|, ,g' -e 's,\^,--exclude=,g' ) + util/lint/checkpatch.pl --quiet --no-signoff $args - + exit $? +# Space separated list of directories to test else INCLUDED_DIRS="$1" fi