From ceae51ad74ba3a16be3e7ee2df4743a6df3cd097 Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Thu, 1 Aug 2024 10:43:41 +0200 Subject: [PATCH] checkpatch: only report error on hit The Linux checkpatch script used by OpenOCD reports hits either as error, warning and check. Such classification is meaningful for Linux maintainers, but for OpenOCD Jenkins they are all considered as errors. Having such classification in the checkpatch report by Jenkins is misleading for developers that expect 'warnings' to be probably ignored by maintainers, while having no idea what 'checks' means. This patch flattens all the checkpatch reports to 'error' only. Checkpatch can trigger false positives. OpenOCD uses the tag Checkpatch-ignore: in the commit message to prevent Jenkins to report the error, as described in HACKING. Change-Id: I1d3164ba1f725c0763dfe362192ffa669b3856e6 Signed-off-by: Antonio Borneo Reviewed-on: https://review.openocd.org/c/openocd/+/8424 Reviewed-by: Karl Palsson Tested-by: jenkins --- tools/scripts/checkpatch.pl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/scripts/checkpatch.pl b/tools/scripts/checkpatch.pl index 26589beab..a2f89eac8 100755 --- a/tools/scripts/checkpatch.pl +++ b/tools/scripts/checkpatch.pl @@ -2384,6 +2384,10 @@ sub show_type { sub report { my ($level, $type, $msg) = @_; + # OpenOCD specific: Begin: Flatten ERROR, WARNING and CHECK as ERROR + $level = 'ERROR'; + # OpenOCD specific: End + if (!show_type($type) || (defined $tst_only && $msg !~ /\Q$tst_only\E/)) { return 0; @@ -7638,9 +7642,15 @@ sub process { print report_dump(); if ($summary && !($clean == 1 && $quiet == 1)) { print "$filename " if ($summary_file); + if (!$OpenOCD) { print "total: $cnt_error errors, $cnt_warn warnings, " . (($check)? "$cnt_chk checks, " : "") . "$cnt_lines lines checked\n"; + } # $OpenOCD + # OpenOCD specific: Begin: Report total as errors + my $total = $cnt_error + $cnt_warn + $cnt_chk; + print "total: $total errors, $cnt_lines lines checked\n"; + # OpenOCD specific: End } if ($quiet == 0) {