linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][RESEND] scripts: add no-warning option to the checkpatch script
@ 2010-12-19  9:28 Marco Stornelli
  2010-12-20  2:52 ` Joe Perches
  0 siblings, 1 reply; 7+ messages in thread
From: Marco Stornelli @ 2010-12-19  9:28 UTC (permalink / raw)
  To: Linux Kernel; +Cc: apw, joe

From: Marco Stornelli <marco.stornelli@gmail.com>

Add no-warning option to the checkpatch script.

Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
---

--- linux-2.6.37-rc6-orig/scripts/checkpatch.pl	2010-12-16 02:24:48.000000000 +0100
+++ linux-2.6.37-rc6/scripts/checkpatch.pl	2010-12-18 10:31:11.000000000 +0100
@@ -15,6 +15,7 @@ my $V = '0.31';
 use Getopt::Long qw(:config no_auto_abbrev);
 
 my $quiet = 0;
+my $chk_warn = 1;
 my $tree = 1;
 my $chk_signoff = 1;
 my $chk_patch = 1;
@@ -39,6 +40,7 @@ Version: $V
 
 Options:
   -q, --quiet                quiet
+  --no-warning               do not report warnings
   --no-tree                  run without a kernel tree
   --no-signoff               do not check for 'Signed-off-by' line
   --patch                    treat FILE as patchfile (default)
@@ -65,6 +67,7 @@ EOM
 
 GetOptions(
 	'q|quiet+'	=> \$quiet,
+	'warning!'	=> \$chk_warn,
 	'tree!'		=> \$tree,
 	'signoff!'	=> \$chk_signoff,
 	'patch!'	=> \$chk_patch,
@@ -1108,7 +1111,7 @@ sub ERROR {
 	}
 }
 sub WARN {
-	if (report("WARNING: $_[0]\n")) {
+	if ($chk_warn && report("WARNING: $_[0]\n")) {
 		our $clean = 0;
 		our $cnt_warn++;
 	}


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][RESEND] scripts: add no-warning option to the checkpatch script
  2010-12-19  9:28 [PATCH][RESEND] scripts: add no-warning option to the checkpatch script Marco Stornelli
@ 2010-12-20  2:52 ` Joe Perches
  2010-12-20  8:37   ` Marco Stornelli
  0 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2010-12-20  2:52 UTC (permalink / raw)
  To: Marco Stornelli; +Cc: Linux Kernel, apw

On Sun, 2010-12-19 at 10:28 +0100, Marco Stornelli wrote:
> From: Marco Stornelli <marco.stornelli@gmail.com>
> Add no-warning option to the checkpatch script.
> Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>

Hello Marco.

I don't have much of an opinion on this.
I don't actually use checkpatch much.
Why do you think it's useful?

It's Andy's code, I just contribute a few
possible additions here and there.

cheers, Joe


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][RESEND] scripts: add no-warning option to the checkpatch script
  2010-12-20  2:52 ` Joe Perches
@ 2010-12-20  8:37   ` Marco Stornelli
  2010-12-20  9:22     ` Joe Perches
  0 siblings, 1 reply; 7+ messages in thread
From: Marco Stornelli @ 2010-12-20  8:37 UTC (permalink / raw)
  To: Joe Perches; +Cc: Linux Kernel, apw

2010/12/20 Joe Perches <joe@perches.com>:
> On Sun, 2010-12-19 at 10:28 +0100, Marco Stornelli wrote:
>> From: Marco Stornelli <marco.stornelli@gmail.com>
>> Add no-warning option to the checkpatch script.
>> Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
>
> Hello Marco.
>
> I don't have much of an opinion on this.
> I don't actually use checkpatch much.
> Why do you think it's useful?

To "debug" a patch from style point of view, I think it's useful to
fix before the errors and then the warnings. So this option it's
useful as a "filter". However, I added you in cc: because of a reply
to my first patch that indicated you as a person interested in this
scope.

Marco

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][RESEND] scripts: add no-warning option to the checkpatch script
  2010-12-20  8:37   ` Marco Stornelli
@ 2010-12-20  9:22     ` Joe Perches
  2010-12-20 11:48       ` Marco Stornelli
  0 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2010-12-20  9:22 UTC (permalink / raw)
  To: Marco Stornelli; +Cc: Linux Kernel, apw

On Mon, 2010-12-20 at 09:37 +0100, Marco Stornelli wrote:
> 2010/12/20 Joe Perches <joe@perches.com>:
> > Why do you think it's useful?
> To "debug" a patch from style point of view, I think it's useful to
> fix before the errors and then the warnings. So this option it's
> useful as a "filter". However, I added you in cc: because of a reply
> to my first patch that indicated you as a person interested in this
> scope.

Perhaps then it'd be better to filter/enable/disable
the 3 current categories of messages.

Maybe something like this:

 scripts/checkpatch.pl |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e3c7fc0..467be6f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -22,7 +22,9 @@ my $tst_only;
 my $emacs = 0;
 my $terse = 0;
 my $file = 0;
-my $check = 0;
+my $emit_error = 1;
+my $emit_warn = 1;
+my $emit_chk = 0;
 my $summary = 1;
 my $mailback = 0;
 my $summary_file = 0;
@@ -45,7 +47,9 @@ Options:
   --emacs                    emacs compile window format
   --terse                    one line per report
   -f, --file                 treat FILE as regular source file
-  --subjective, --strict     enable more subjective tests
+  --errors                   print the errors found (default: 1=on, 0=off)
+  --warnings                 print the warnings found (default: 1=on, 0=off)
+  --subjective, --strict     print the subjective defects found (default: 0=off)
   --root=PATH                PATH to the kernel tree root
   --no-summary               suppress the per-file summary
   --mailback                 only produce a report in case of warnings/errors
@@ -71,8 +75,10 @@ GetOptions(
 	'emacs!'	=> \$emacs,
 	'terse!'	=> \$terse,
 	'f|file!'	=> \$file,
-	'subjective!'	=> \$check,
-	'strict!'	=> \$check,
+	'errors!'	=> \$emit_error,
+	'warnings!'	=> \$emit_warn,
+	'subjective!'	=> \$emit_chk,
+	'strict!'	=> \$emit_chk,
 	'root=s'	=> \$root,
 	'summary!'	=> \$summary,
 	'mailback!'	=> \$mailback,
@@ -1102,19 +1108,19 @@ sub report_dump {
 	our @report;
 }
 sub ERROR {
-	if (report("ERROR: $_[0]\n")) {
+	if ($emit_error && report("ERROR: $_[0]\n")) {
 		our $clean = 0;
 		our $cnt_error++;
 	}
 }
 sub WARN {
-	if (report("WARNING: $_[0]\n")) {
+	if ($emit_warn && report("WARNING: $_[0]\n")) {
 		our $clean = 0;
 		our $cnt_warn++;
 	}
 }
 sub CHK {
-	if ($check && report("CHECK: $_[0]\n")) {
+	if ($emit_chk && report("CHECK: $_[0]\n")) {
 		our $clean = 0;
 		our $cnt_chk++;
 	}
@@ -2922,9 +2928,11 @@ sub process {
 	print report_dump();
 	if ($summary && !($clean == 1 && $quiet == 1)) {
 		print "$filename " if ($summary_file);
-		print "total: $cnt_error errors, $cnt_warn warnings, " .
-			(($check)? "$cnt_chk checks, " : "") .
-			"$cnt_lines lines checked\n";
+		print "total:" .
+			(($emit_error) ? " $cnt_error errors," : "") .
+			(($emit_warn) ? " $cnt_warn warnings," : "") .
+			(($emit_chk) ? " $cnt_chk checks," : "") .
+			" $cnt_lines lines checked\n";
 		print "\n" if ($quiet == 0);
 	}
 



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH][RESEND] scripts: add no-warning option to the checkpatch script
  2010-12-20  9:22     ` Joe Perches
@ 2010-12-20 11:48       ` Marco Stornelli
  2010-12-20 12:06         ` Joe Perches
  0 siblings, 1 reply; 7+ messages in thread
From: Marco Stornelli @ 2010-12-20 11:48 UTC (permalink / raw)
  To: Joe Perches; +Cc: Linux Kernel, apw

2010/12/20 Joe Perches <joe@perches.com>:
> On Mon, 2010-12-20 at 09:37 +0100, Marco Stornelli wrote:
>> 2010/12/20 Joe Perches <joe@perches.com>:
>> > Why do you think it's useful?
>> To "debug" a patch from style point of view, I think it's useful to
>> fix before the errors and then the warnings. So this option it's
>> useful as a "filter". However, I added you in cc: because of a reply
>> to my first patch that indicated you as a person interested in this
>> scope.
>
> Perhaps then it'd be better to filter/enable/disable
> the 3 current categories of messages.
>
> Maybe something like this:

Yeah, very good. Will it be inserted in mainline?

Marco

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][RESEND] scripts: add no-warning option to the checkpatch script
  2010-12-20 11:48       ` Marco Stornelli
@ 2010-12-20 12:06         ` Joe Perches
  2010-12-21 12:51           ` Andy Whitcroft
  0 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2010-12-20 12:06 UTC (permalink / raw)
  To: Marco Stornelli; +Cc: Linux Kernel, apw

On Mon, 2010-12-20 at 12:48 +0100, Marco Stornelli wrote:
> 2010/12/20 Joe Perches <joe@perches.com>:
> > On Mon, 2010-12-20 at 09:37 +0100, Marco Stornelli wrote:
> >> 2010/12/20 Joe Perches <joe@perches.com>:
> >> > Why do you think it's useful?
> >> To "debug" a patch from style point of view, I think it's useful to
> >> fix before the errors and then the warnings. So this option it's
> >> useful as a "filter". However, I added you in cc: because of a reply
> >> to my first patch that indicated you as a person interested in this
> >> scope.
> > Perhaps then it'd be better to filter/enable/disable
> > the 3 current categories of messages.
> > Maybe something like this:
> Yeah, very good. Will it be inserted in mainline?

Dunno.  Maybe if Andy thinks it worthwhile.
He takes his time about this sort of thing.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][RESEND] scripts: add no-warning option to the checkpatch script
  2010-12-20 12:06         ` Joe Perches
@ 2010-12-21 12:51           ` Andy Whitcroft
  0 siblings, 0 replies; 7+ messages in thread
From: Andy Whitcroft @ 2010-12-21 12:51 UTC (permalink / raw)
  To: Joe Perches; +Cc: Marco Stornelli, Linux Kernel

On Mon, Dec 20, 2010 at 04:06:10AM -0800, Joe Perches wrote:
> On Mon, 2010-12-20 at 12:48 +0100, Marco Stornelli wrote:
> > 2010/12/20 Joe Perches <joe@perches.com>:
> > > On Mon, 2010-12-20 at 09:37 +0100, Marco Stornelli wrote:
> > >> 2010/12/20 Joe Perches <joe@perches.com>:
> > >> > Why do you think it's useful?
> > >> To "debug" a patch from style point of view, I think it's useful to
> > >> fix before the errors and then the warnings. So this option it's
> > >> useful as a "filter". However, I added you in cc: because of a reply
> > >> to my first patch that indicated you as a person interested in this
> > >> scope.
> > > Perhaps then it'd be better to filter/enable/disable
> > > the 3 current categories of messages.
> > > Maybe something like this:
> > Yeah, very good. Will it be inserted in mainline?
> 
> Dunno.  Maybe if Andy thinks it worthwhile.
> He takes his time about this sort of thing.

At a quick skim that seems a more comprehensive approach.  I've been lax
as always picking things up but with the quiet time coming I hope to
hoover up the left overs and push them out.

Thanks.

-apw

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-12-21 12:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-19  9:28 [PATCH][RESEND] scripts: add no-warning option to the checkpatch script Marco Stornelli
2010-12-20  2:52 ` Joe Perches
2010-12-20  8:37   ` Marco Stornelli
2010-12-20  9:22     ` Joe Perches
2010-12-20 11:48       ` Marco Stornelli
2010-12-20 12:06         ` Joe Perches
2010-12-21 12:51           ` Andy Whitcroft

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).