History

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.

Joe Perches committed 11 years ago

Commit d8469f11 parent 47e0c881 file · +39 −23Browse files

Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+39−23
@@ -197,11 +197,11 @@ sub hash_show_words { · 196 unmodified lines
197197 my ($hashRef, $prefix) = @_;
198198
199199 if ($quiet == 0 && keys %$hashRef) {
200− print "NOTE: $prefix message types:";
200+ print "\nNOTE: $prefix message types:";
201201 foreach my $word (sort keys %$hashRef) {
202202 print " $word";
203203 }
204− print "\n\n";
204+ print "\n";
205205 }
206206 }
207207
@@ -741,6 +741,13 @@ for my $filename (@ARGV) { · 533 unmodified lines
741741 push(@rawlines, $_);
742742 }
743743 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+
744751 if (!process($filename)) {
745752 $exit = 1;
746753 }
@@ -755,6 +762,23 @@ for my $filename (@ARGV) { · 8 unmodified lines
755762 build_types();
756763 }
757764
765+if (!$quiet) {
766+ if ($^V lt 5.10.0) {
767+ print << "EOM"
768+
769+NOTE: perl $^V is not modern enough to detect all possible issues.
770+ An upgrade to at least perl v5.10.0 is suggested.
771+EOM
772+ }
773+ if ($exit) {
774+ print << "EOM"
775+
776+NOTE: If any of the errors are false positives, please report
777+ them to the maintainer, see CHECKPATCH in MAINTAINERS.
778+EOM
779+ }
780+}
781+
758782 exit($exit);
759783
760784 sub top_of_kernel_tree {
@@ -5578,22 +5602,18 @@ sub process { · 4817 unmodified lines
55785602 print "total: $cnt_error errors, $cnt_warn warnings, " .
55795603 (($check)? "$cnt_chk checks, " : "") .
55805604 "$cnt_lines lines checked\n";
5581− print "\n" if ($quiet == 0);
55825605 }
55835606
55845607 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−
55915608 # If there were whitespace errors which cleanpatch can fix
55925609 # then suggest that.
55935610 if ($rpt_cleaners) {
5594− print "NOTE: whitespace errors detected, you may wish to use scripts/cleanpatch or\n";
5595− print " scripts/cleanfile\n\n";
55965611 $rpt_cleaners = 0;
5612+ print << "EOM"
5613+
5614+NOTE: Whitespace errors detected.
5615+ You may wish to use scripts/cleanpatch or scripts/cleanfile
5616+EOM
55975617 }
55985618 }
55995619
@@ -5627,6 +5647,7 @@ sub process { · 27 unmodified lines
56275647
56285648 if (!$quiet) {
56295649 print << "EOM";
5650+
56305651 Wrote EXPERIMENTAL --fix correction(s) to '$newfile'
56315652
56325653 Do _NOT_ trust the results written to this file.
@@ -5634,22 +5655,17 @@ Do _NOT_ submit these changes without inspecting them for correctness. · 1 unmodified line
56345655
56355656 This EXPERIMENTAL file is simply a convenience to help rewrite patches.
56365657 No warranties, expressed or implied...
5637−
56385658 EOM
56395659 }
56405660 }
56415661
5642− if ($clean == 1 && $quiet == 0) {
5643− print "$vname has no obvious style problems and is ready for submission.\n"
5644− }
5645− if ($clean == 0 && $quiet == 0) {
5646− print << "EOM";
5647−$vname has style problems, please review.
5648−
5649−If any of these errors are false positives, please report
5650−them to the maintainer, see CHECKPATCH in MAINTAINERS.
5651−EOM
5662+ if ($quiet == 0) {
5663+ print "\n";
5664+ if ($clean == 1) {
5665+ print "$vname has no obvious style problems and is ready for submission.\n";
5666+ } else {
5667+ print "$vname has style problems, please review.\n";
5668+ }
56525669 }
5653−
56545670 return $clean;
56555671 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t