Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1157802

[PATCH 1/3] checkpatch: Improve output with multiple command-line files

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject [PATCH 1/3] checkpatch: Improve output with multiple command-line files
Date Wed, 03 Jun 2015 18:00:03 +0200
Message-ID <pxjfc-5DK-23@gated-at.bofh.it> (permalink)
References <pxjfb-5DK-1@gated-at.bofh.it>
X-Original-To Andrew Morton <akpm@linux-foundation.org>, Andy Whitcroft <apw@canonical.com>
X-Session-Marker 6A6F6540706572636865732E636F6D
X-Spam-Summary 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:69:355:379:541:800:960:973:982:983:988:989:1208:1260:1345:1359:1437:1534:1543:1605:1711:1730:1747:1777:1792:2393:2553:2559:2562:2911:3138:3139:3140:3141:3142:3653:3865:3866:3867:3868:3870:3871:3873:3874:4250:4425:4605:5007:6261:6691:7903:7904:9592:10004:10848:11026:11232:11233:11658:11914:12043:12291:12517:12519:12555:12660:12683:13095:13184:13229:14093:14394:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0
X-He-Tag trip79_78009c5433106
X-Filterd-Recvd-Size 4683
X-Mailer git-send-email 2.1.2
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 151
Organization linux.* mail to news gateway
X-Original-Cc Petr Mladek <pmladek@suse.cz>, linux-kernel@vger.kernel.org
X-Original-Date Wed, 3 Jun 2015 08:53:38 -0700
X-Original-Message-ID <d5a2b71b4ec735b70c326ed2554d8c627f13c248.1433346576.git.joe@perches.com>
X-Original-References <cover.1433346576.git.joe@perches.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1157802

Show key headers only | View raw


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.

Suggested-by: Petr Mladek <pmladek@suse.cz>
Signed-off-by: Joe Perches <joe@perches.com>
---
 scripts/checkpatch.pl | 62 ++++++++++++++++++++++++++++++++-------------------
 1 file changed, 39 insertions(+), 23 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index c8032a0..eaa76bd 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -197,11 +197,11 @@ sub hash_show_words {
 	my ($hashRef, $prefix) = @_;
 
 	if ($quiet == 0 && keys %$hashRef) {
-		print "NOTE: $prefix message types:";
+		print "\nNOTE: $prefix message types:";
 		foreach my $word (sort keys %$hashRef) {
 			print " $word";
 		}
-		print "\n\n";
+		print "\n";
 	}
 }
 
@@ -741,6 +741,13 @@ for my $filename (@ARGV) {
 		push(@rawlines, $_);
 	}
 	close($FILE);
+
+	if ($#ARGV > 0 && $quiet == 0) {
+		print '-' x length($vname) . "\n";
+		print "$vname\n";
+		print '-' x length($vname) . "\n";
+	}
+
 	if (!process($filename)) {
 		$exit = 1;
 	}
@@ -755,6 +762,23 @@ for my $filename (@ARGV) {
 	build_types();
 }
 
+if (!$quiet) {
+	if ($^V lt 5.10.0) {
+		print << "EOM"
+
+NOTE: perl $^V is not modern enough to detect all possible issues.
+      An upgrade to at least perl v5.10.0 is suggested.
+EOM
+	}
+	if ($exit) {
+		print << "EOM"
+
+NOTE: If any of the errors are false positives, please report
+      them to the maintainer, see CHECKPATCH in MAINTAINERS.
+EOM
+	}
+}
+
 exit($exit);
 
 sub top_of_kernel_tree {
@@ -5578,22 +5602,18 @@ sub process {
 		print "total: $cnt_error errors, $cnt_warn warnings, " .
 			(($check)? "$cnt_chk checks, " : "") .
 			"$cnt_lines lines checked\n";
-		print "\n" if ($quiet == 0);
 	}
 
 	if ($quiet == 0) {
-
-		if ($^V lt 5.10.0) {
-			print("NOTE: perl $^V is not modern enough to detect all possible issues.\n");
-			print("An upgrade to at least perl v5.10.0 is suggested.\n\n");
-		}
-
 		# 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";
 			$rpt_cleaners = 0;
+			print << "EOM"
+
+NOTE: Whitespace errors detected.
+      You may wish to use scripts/cleanpatch or scripts/cleanfile
+EOM
 		}
 	}
 
@@ -5627,6 +5647,7 @@ sub process {
 
 		if (!$quiet) {
 			print << "EOM";
+
 Wrote EXPERIMENTAL --fix correction(s) to '$newfile'
 
 Do _NOT_ trust the results written to this file.
@@ -5634,22 +5655,17 @@ Do _NOT_ submit these changes without inspecting them for correctness.
 
 This EXPERIMENTAL file is simply a convenience to help rewrite patches.
 No warranties, expressed or implied...
-
 EOM
 		}
 	}
 
-	if ($clean == 1 && $quiet == 0) {
-		print "$vname has no obvious style problems and is ready for submission.\n"
-	}
-	if ($clean == 0 && $quiet == 0) {
-		print << "EOM";
-$vname has style problems, please review.
-
-If any of these errors are false positives, please report
-them to the maintainer, see CHECKPATCH in MAINTAINERS.
-EOM
+	if ($quiet == 0) {
+		print "\n";
+		if ($clean == 1) {
+			print "$vname has no obvious style problems and is ready for submission.\n";
+		} else {
+			print "$vname has style problems, please review.\n";
+		}
 	}
-
 	return $clean;
 }
-- 
2.1.2

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

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] checkpatch: output style changes Joe Perches <joe@perches.com> - 2015-06-03 18:00 +0200
  [PATCH 2/3] checkpatch: colorize output to terminal Joe Perches <joe@perches.com> - 2015-06-03 18:00 +0200
    Re: [PATCH 2/3] checkpatch: colorize output to terminal Petr Mladek <pmladek@suse.cz> - 2015-06-04 14:10 +0200
  [PATCH 1/3] checkpatch: Improve output with multiple command-line files Joe Perches <joe@perches.com> - 2015-06-03 18:00 +0200
    Re: [PATCH 1/3] checkpatch: Improve output with multiple  command-line files Petr Mladek <pmladek@suse.cz> - 2015-06-04 14:10 +0200
      Re: [PATCH 1/3] checkpatch: Improve output with multiple  command-line files Joe Perches <joe@perches.com> - 2015-06-04 14:20 +0200
  [PATCH 3/3] checkpatch: Add --showfile to allow input via pipe to show filenames Joe Perches <joe@perches.com> - 2015-06-03 18:00 +0200
    Re: [PATCH 3/3] checkpatch: Add --showfile to allow input via pipe  to show filenames Petr Mladek <pmladek@suse.cz> - 2015-06-04 14:20 +0200

csiph-web