Skip to content

Commit

Permalink
checkpatch: only report error on hit
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8424
Reviewed-by: Karl Palsson <[email protected]>
Tested-by: jenkins
  • Loading branch information
borneoa committed Aug 25, 2024
1 parent bfd3110 commit ceae51a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tools/scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit ceae51a

Please sign in to comment.