diff options
author | Antonio Nino Diaz <antonio.ninodiaz@arm.com> | 2018-01-05 09:59:00 +0000 |
---|---|---|
committer | Antonio Nino Diaz <antonio.ninodiaz@arm.com> | 2018-01-26 10:46:56 +0000 |
commit | f29f2b468d53a97aa0906dc04ac75bd28420aa4a (patch) | |
tree | 0ea714984e87f8a5bf99c2a9ebba40a7881d8ade | |
parent | 801fd82316e75c774c1d441cd13cd0be370d37fc (diff) |
Analyze coding style of patches individually
With the old system `checkpatch.pl` gets one sole input that consists on
the commit message and commit diff of each commit between BASE_COMMIT
and HEAD. It also filters out changes in some files, which makes `git
format-patch` completely ignore that commit, even the commit message.
With the new system the commit message and commit diff are analyzed
separately. This means that, even if all the files modified by a commit
are filtered out, the commit message will still be analyzed.
Also, all commits are analyzed individually. This way it's easier to
know which commit caused the problem, and there are no warnings about
repeated "Signed-off-by" lines.
Change-Id: I1f8e141772e8d58d9b75d4747c82023ef30e6652
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
-rw-r--r-- | .checkpatch.conf | 7 | ||||
-rw-r--r-- | Makefile | 9 |
2 files changed, 15 insertions, 1 deletions
diff --git a/.checkpatch.conf b/.checkpatch.conf index 0bb3865..01a77fb 100644 --- a/.checkpatch.conf +++ b/.checkpatch.conf @@ -21,6 +21,10 @@ # drivers/arm/gic/arm_gic_v2v3.c:160: --showfile +# Don't show some messages like the list of ignored types or the suggestion to +# use "--fix" or report changes to the maintainers. +--quiet + # # Ignore the following message types, as they don't necessarily make sense in # the context of the TFTF. @@ -47,6 +51,9 @@ # We allow adding new typedefs in TFTF. --ignore NEW_TYPEDEFS +# Avoid "Does not appear to be a unified-diff format patch" message +--ignore NOT_UNIFIED_DIFF + # VOLATILE reports this kind of messages: # "Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt" # We allow the usage of the volatile keyword in TFTF. @@ -305,7 +305,14 @@ checkcodebase: locate-checkpatch checkpatch: locate-checkpatch @echo " CHECKING STYLE" - ${Q}git format-patch --stdout ${BASE_COMMIT}..HEAD -- ${CHECK_PATHS} | ${CHECKPATCH} - || true + ${Q}COMMON_COMMIT=$$(git merge-base HEAD ${BASE_COMMIT}); \ + for commit in `git rev-list $$COMMON_COMMIT..HEAD`; do \ + printf "\n[*] Checking style of '$$commit'\n\n"; \ + git log --format=email "$$commit~..$$commit" \ + -- ${CHECK_PATHS} | ${CHECKPATCH} - || true; \ + git diff --format=email "$$commit~..$$commit" \ + -- ${CHECK_PATHS} | ${CHECKPATCH} - || true; \ + done define match_goals $(strip $(foreach goal,$(1),$(filter $(goal),$(MAKECMDGOALS)))) |