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
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) { · 533 unmodified lines
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) { · 8 unmodified lines
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 { · 4817 unmodified lines
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 fix5608 # 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 { · 27 unmodified lines
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. · 1 unmodified line
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
5638EOM5658EOM
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}

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