summaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2015-06-25 18:03:00 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-06-25 20:00:41 -0400
commitd8469f16207c626d71749ada88c13db1238df39e (patch)
treefa8e6458a44731192b81bf98697edf71f047303d /scripts/checkpatch.pl
parent47e0c88b37a5c3d6732f4ec896dfa8aa55868b4f (diff)
checkpatch: improve output with multiple command-line files
If there are multiple patches/files on the command line, use a prefix before the patch/file message output like: -------------- patch/filename -------------- to make the identifying which messages go with which file/patch a bit easier to parse. Move the perl version and false positive messages after all the files have been scanned so that they are emitted only once. Standardize the NOTE: <...> form to always emit a blank line before the NOTE and always use print << "EOM" style. Signed-off-by: Joe Perches <joe@perches.com> Suggested-by: Petr Mladek <pmladek@suse.cz> Tested-by: Petr Mladek <pmladek@suse.cz> Cc: 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 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl62
1 files changed, 39 insertions, 23 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 34f1415ae964..1b999cc035ff 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -197,11 +197,11 @@ sub hash_show_words {
197 my ($hashRef, $prefix) = @_; 197 my ($hashRef, $prefix) = @_;
198 198
199 if ($quiet == 0 && keys %$hashRef) { 199 if ($quiet == 0 && keys %$hashRef) {
200 print "NOTE: $prefix message types:"; 200 print "\nNOTE: $prefix message types:";
201 foreach my $word (sort keys %$hashRef) { 201 foreach my $word (sort keys %$hashRef) {
202 print " $word"; 202 print " $word";
203 } 203 }
204 print "\n\n"; 204 print "\n";
205 } 205 }
206} 206}
207 207
@@ -741,6 +741,13 @@ for my $filename (@ARGV) {
741 push(@rawlines, $_); 741 push(@rawlines, $_);
742 } 742 }
743 close($FILE); 743 close($FILE);
744
745 if ($#ARGV > 0 && $quiet == 0) {
746 print '-' x length($vname) . "\n";
747 print "$vname\n";
748 print '-' x length($vname) . "\n";
749 }
750
744 if (!process($filename)) { 751 if (!process($filename)) {
745 $exit = 1; 752 $exit = 1;
746 } 753 }
@@ -755,6 +762,23 @@ for my $filename (@ARGV) {
755 build_types(); 762 build_types();
756} 763}
757 764
765if (!$quiet) {
766 if ($^V lt 5.10.0) {
767 print << "EOM"
768
769NOTE: perl $^V is not modern enough to detect all possible issues.
770 An upgrade to at least perl v5.10.0 is suggested.
771EOM
772 }
773 if ($exit) {
774 print << "EOM"
775
776NOTE: If any of the errors are false positives, please report
777 them to the maintainer, see CHECKPATCH in MAINTAINERS.
778EOM
779 }
780}
781
758exit($exit); 782exit($exit);
759 783
760sub top_of_kernel_tree { 784sub top_of_kernel_tree {
@@ -5578,22 +5602,18 @@ sub process {
5578 print "total: $cnt_error errors, $cnt_warn warnings, " . 5602 print "total: $cnt_error errors, $cnt_warn warnings, " .
5579 (($check)? "$cnt_chk checks, " : "") . 5603 (($check)? "$cnt_chk checks, " : "") .
5580 "$cnt_lines lines checked\n"; 5604 "$cnt_lines lines checked\n";
5581 print "\n" if ($quiet == 0);
5582 } 5605 }
5583 5606
5584 if ($quiet == 0) { 5607 if ($quiet == 0) {
5585
5586 if ($^V lt 5.10.0) {
5587 print("NOTE: perl $^V is not modern enough to detect all possible issues.\n");
5588 print("An upgrade to at least perl v5.10.0 is suggested.\n\n");
5589 }
5590
5591 # If there were whitespace errors which cleanpatch can fix 5608 # If there were whitespace errors which cleanpatch can fix
5592 # then suggest that. 5609 # then suggest that.
5593 if ($rpt_cleaners) { 5610 if ($rpt_cleaners) {
5594 print "NOTE: whitespace errors detected, you may wish to use scripts/cleanpatch or\n";
5595 print " scripts/cleanfile\n\n";
5596 $rpt_cleaners = 0; 5611 $rpt_cleaners = 0;
5612 print << "EOM"
5613
5614NOTE: Whitespace errors detected.
5615 You may wish to use scripts/cleanpatch or scripts/cleanfile
5616EOM
5597 } 5617 }
5598 } 5618 }
5599 5619
@@ -5627,6 +5647,7 @@ sub process {
5627 5647
5628 if (!$quiet) { 5648 if (!$quiet) {
5629 print << "EOM"; 5649 print << "EOM";
5650
5630Wrote EXPERIMENTAL --fix correction(s) to '$newfile' 5651Wrote EXPERIMENTAL --fix correction(s) to '$newfile'
5631 5652
5632Do _NOT_ trust the results written to this file. 5653Do _NOT_ trust the results written to this file.
@@ -5634,22 +5655,17 @@ Do _NOT_ submit these changes without inspecting them for correctness.
5634 5655
5635This EXPERIMENTAL file is simply a convenience to help rewrite patches. 5656This EXPERIMENTAL file is simply a convenience to help rewrite patches.
5636No warranties, expressed or implied... 5657No warranties, expressed or implied...
5637
5638EOM 5658EOM
5639 } 5659 }
5640 } 5660 }
5641 5661
5642 if ($clean == 1 && $quiet == 0) { 5662 if ($quiet == 0) {
5643 print "$vname has no obvious style problems and is ready for submission.\n" 5663 print "\n";
5644 } 5664 if ($clean == 1) {
5645 if ($clean == 0 && $quiet == 0) { 5665 print "$vname has no obvious style problems and is ready for submission.\n";
5646 print << "EOM"; 5666 } else {
5647$vname has style problems, please review. 5667 print "$vname has style problems, please review.\n";
5648 5668 }
5649If any of these errors are false positives, please report
5650them to the maintainer, see CHECKPATCH in MAINTAINERS.
5651EOM
5652 } 5669 }
5653
5654 return $clean; 5670 return $clean;
5655} 5671}