From: Antonio Borneo Date: Fri, 16 Apr 2021 21:57:06 +0000 (+0200) Subject: checkpatch: add commit-message field to ignore some check X-Git-Tag: v0.12.0-rc1~6 X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=commitdiff_plain;h=496308701342032d54bfe04c6e2653be252ccd94 checkpatch: add commit-message field to ignore some check The script 'checkpatch.pl' is part of the automatic tests used by Linux Maintainers and developers to test new patches. The Linux development process is e-mail base. An error reported by checkpatch is not a blocking point; the developer can explain in the e-mail why he is submitting a patch that fails at checkpatch or that is in violation of the coding style. It's up to the maintainer to decide to accept or reject the explanation and then the patch. The OpenOCD development process relies on Gerrit and Jenkins as front-end tools. Jenkins tests every new patch with checkpatch and then builds the new code. If checkpatch fails, Jenkins adds a failure label to the patch; this often causes the patch to get ignored by maintainers that considers it as 'not ready'. Checkpatch can be instrumented to ignore some test, but this has to be specified in the command line or in the configuration file. Let checkpatch extract from the patch's commit message the new field 'Checkpatch-ignore:' that lists the additional tests that has to be ignored for that patch only. The developer that detects as error or a limitation in checkpatch can add the field and the problematic test in the commit message and re-push the patch. The maintainer should check the list of tests and decide how to proceed. Change-Id: Iafc1b2893a07c7b3fc7e3ad15bd694aba9bd8519 Signed-off-by: Antonio Borneo Reviewed-on: https://review.openocd.org/c/openocd/+/6169 Tested-by: jenkins --- diff --git a/tools/scripts/checkpatch.pl b/tools/scripts/checkpatch.pl index 14876a114b..12e7ab855d 100755 --- a/tools/scripts/checkpatch.pl +++ b/tools/scripts/checkpatch.pl @@ -3011,6 +3011,13 @@ sub process { } } +# OpenOCD specific: Begin: Extend list of checkpatch tests to ignore + if ($in_commit_log && $line =~ /^\s*Checkpatch-ignore:\s*(.*)/) { + my @array = split(/[\s,]+/, $1); + hash_save_array_words(\%ignore_type, \@array); + } +# OpenOCD specific: End + # Check for patch separator if ($line =~ /^---$/) { $has_patch_separator = 1;