From 73615ba5de05a57c298b6006810c52d64231e014 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Mon, 6 Apr 2020 22:47:25 -0700 Subject: [PATCH 1/2] .travis.yml: swap Travis and Jenkins check patch --strict roles. checkpatch has a --subjective (a.k.a --strict) option that enables a few additional "checks". These additional "--strict checks" are desired but - as expected from their name - their output is likely to be dismissed more frequently than other checkpatch issues. For that reason, a relatively complex post-processing Jenkins change was made on the 22nd November 2019. After that change, --strict checks were still run by Jenkins however --strict-only failures were "downgraded" to a green success. For a good example look at sof-ci/jenkins/pr-checkpatch and continuous-integration/travis-ci/pr details in PR #1967. This small Travis PR is meant to be merged immediately after the REMOVAL of that complex checkpatch post-processing in Jenkins, swapping who dismisses strict-only failures and who doesn't. This swap is not just about replacing about 50 lines of internal Jenkins code with a couple of lines of visible code in travis and checkpatch: after this swap, a green continuous-integration/travis-ci/pr success and a red sof-ci/jenkins/pr-checkpatch failure can have only one meaning: a strict-only failure. Before this swap, no combination on the github page ever identifies a strict-only failure. Of course, it would be easier to have a real "yellow" color instead of running checkpatch twice and creatively mixing one green and one red. Unfortunately, neither Travis nor github seem to support anytihng besides red and green: https://github.com/travis-ci/travis-ci/issues/4730 https://developer.github.com/v3/repos/statuses/ https://github-api.kohsuke.org/apidocs/org/kohsuke/ github/GHCommitState.html Signed-off-by: Marc Herbert --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a75aac508de299..8b819c48a7599f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,9 +15,10 @@ jobs: include: - if: type = pull_request name: checkpatch - script: + script: # FIXME: replace with TRAVIS_COMMIT_RANGE or similar - SHA_PR=`git log --oneline -1 | sed -rn "s/.*Merge (.*) into.*/\1/p"` - SHA_MAIN=`git log --oneline -1 | sed -rn "s/.*Merge .* into (.*)/\1/p"` + - git fetch https://github.com/marc-hb/linux checkpatch-strict-not-fatal && git cherry-pick FETCH_HEAD - scripts/checkpatch.pl --strict --codespell -g $SHA_MAIN..$SHA_PR - name: "Code Scan" script: From 4b3606e9fcff5f68bdb45df346c6c13de549b730 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Mon, 6 Apr 2020 23:08:56 -0700 Subject: [PATCH 2/2] Fake check patch CHK to test previous commit Just a test. Signed-off-by: Marc Herbert --- .travis.yml | 2 +- scripts/checkpatch.pl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8b819c48a7599f..6b7409f158eeff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ jobs: include: - if: type = pull_request name: checkpatch - script: # FIXME: replace with TRAVIS_COMMIT_RANGE or similar + script: # FIXME: replace with TRAVIS_COMMIT_RANGE or similiar - SHA_PR=`git log --oneline -1 | sed -rn "s/.*Merge (.*) into.*/\1/p"` - SHA_MAIN=`git log --oneline -1 | sed -rn "s/.*Merge .* into (.*)/\1/p"` - git fetch https://github.com/marc-hb/linux checkpatch-strict-not-fatal && git cherry-pick FETCH_HEAD diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index a63380c6b0d20f..04e7f3272cfe48 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2904,7 +2904,7 @@ sub process { my $typo_fix = $spelling_fix{lc($typo)}; $typo_fix = ucfirst($typo_fix) if ($typo =~ /^[A-Z]/); $typo_fix = uc($typo_fix) if ($typo =~ /^[A-Z]+$/); - my $msg_level = \&WARN; + my $msg_level = \&CHK; $msg_level = \&CHK if ($file); if (&{$msg_level}("TYPO_SPELLING", "'$typo' may be misspelled - perhaps '$typo_fix'?\n" . $herecurr) &&