[PATCH] checkpatch: Don't suggest clean scripts when all relatederrors are suppressed

From: Matthijs Kooijman
Date: Wed Apr 10 2013 - 04:50:05 EST


Before, the message "whitespace errors detected, you may wish to use
scripts/cleanpatch or scripts/cleanfile" was emitted when two specific
errors were detected, even when they were suppressed with --ignore or
--test-only.

Now, the message is only emitted if any of the related errors were
actually emitted as well.

Signed-off-by: Matthijs Kooijman <matthijs@xxxxxxxx>
---
scripts/checkpatch.pl | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 64021da..532c41b 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1278,19 +1278,25 @@ sub ERROR {
if (report("ERROR", $_[0], $_[1])) {
our $clean = 0;
our $cnt_error++;
+ return 1;
}
+ return 0;
}
sub WARN {
if (report("WARNING", $_[0], $_[1])) {
our $clean = 0;
our $cnt_warn++;
+ return 1;
}
+ return 0;
}
sub CHK {
if ($check && report("CHECK", $_[0], $_[1])) {
our $clean = 0;
our $cnt_chk++;
+ return 1;
}
+ return 0;
}

sub check_absolute_file {
@@ -1701,9 +1707,10 @@ sub process {

} elsif ($rawline =~ /^\+.*\S\s+$/ || $rawline =~ /^\+\s+$/) {
my $herevet = "$here\n" . cat_vet($rawline) . "\n";
- ERROR("TRAILING_WHITESPACE",
- "trailing whitespace\n" . $herevet);
- $rpt_cleaners = 1;
+ if (ERROR("TRAILING_WHITESPACE",
+ "trailing whitespace\n" . $herevet)) {
+ $rpt_cleaners = 1;
+ }
}

# check for Kconfig help text having a real description
@@ -1829,9 +1836,10 @@ sub process {
if ($rawline =~ /^\+\s* \t\s*\S/ ||
$rawline =~ /^\+\s* \s*/) {
my $herevet = "$here\n" . cat_vet($rawline) . "\n";
- ERROR("CODE_INDENT",
- "code indent should use tabs where possible\n" . $herevet);
- $rpt_cleaners = 1;
+ if (ERROR("CODE_INDENT",
+ "code indent should use tabs where possible\n" . $herevet)) {
+ $rpt_cleaners = 1;
+ }
}

# check for space before tabs.
--
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/