summaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorAndy Whitcroft <apw@canonical.com>2010-10-26 23:23:12 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-27 01:52:19 +0200
commitd2c0a23514d8ac4ed10a8e742467cfb72ca3bed8 (patch)
treea3c0283ee6cdcaa92ecf9ae2ec7a4f1e627c359c /scripts/checkpatch.pl
parentcheckpatch: types may sit on a line on their own (diff)
downloadlinux-d2c0a23514d8ac4ed10a8e742467cfb72ca3bed8.tar.xz
linux-d2c0a23514d8ac4ed10a8e742467cfb72ca3bed8.zip
checkpatch: suggest cleanpatch and cleanfile when appropriate
When we hit types of whitespace which may be fixed by scripts/cleanpatch and scripts/cleanfile suggest their use in our report. Suggested-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to '')
-rwxr-xr-xscripts/checkpatch.pl13
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 41f59b1e209b..32d6a236570d 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -103,6 +103,8 @@ for my $key (keys %debug) {
die "$@" if ($@);
}
+my $rpt_cleaners = 0;
+
if ($terse) {
$emacs = 1;
$quiet++;
@@ -1389,6 +1391,7 @@ sub process {
} elsif ($rawline =~ /^\+.*\S\s+$/ || $rawline =~ /^\+\s+$/) {
my $herevet = "$here\n" . cat_vet($rawline) . "\n";
ERROR("trailing whitespace\n" . $herevet);
+ $rpt_cleaners = 1;
}
# check for Kconfig help text having a real description
@@ -1450,6 +1453,7 @@ sub process {
$rawline =~ /^\+\s* \s*/) {
my $herevet = "$here\n" . cat_vet($rawline) . "\n";
ERROR("code indent should use tabs where possible\n" . $herevet);
+ $rpt_cleaners = 1;
}
# check for space before tabs.
@@ -2842,6 +2846,15 @@ sub process {
print "\n" if ($quiet == 0);
}
+ if ($quiet == 0) {
+ # If there were whitespace errors which cleanpatch can fix
+ # then suggest that.
+ if ($rpt_cleaners) {
+ print "NOTE: whitespace errors detected, you may wish to use scripts/cleanpatch or\n";
+ print " scripts/cleanfile\n\n";
+ }
+ }
+
if ($clean == 1 && $quiet == 0) {
print "$vname has no obvious style problems and is ready for submission.\n"
}