linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* PATCH] patch to generate warning when signed-of line in patch in not proper
@ 2011-05-19 17:23 anish
       [not found] ` <BANLkTik2NVHNbG4mSZDWJ2Mt5i6AhGr+uw@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: anish @ 2011-05-19 17:23 UTC (permalink / raw)
  To: apw, greg, man.k1983; +Cc: linux-kernel

From: anish kumar <anish198519851985@gmail.com>

This patch generates warning when there is no space between the
patch submitter name and successive mail-id.

Signed-off-by: anish kumar <anish198519851985@gmail.com>
---
 scripts/checkpatch.pl |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d867081..437c6d4 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1373,10 +1373,16 @@ sub process {
 				WARN("Signed-off-by: is the preferred form\n" .
 					$herecurr);
 			}
-			if ($line =~ /^\s*signed-off-by:\S/i) {
-				WARN("space required after Signed-off-by:\n" .
+			if ($line =~ /^\s*signed-off-by:(.*)/i) {
+			 if($1 !~ /^(\s[a-zA-Z].*)/i) {
+				WARN("Space required after Signed-off-by:\n" .
 					$herecurr);
 			}
+			if($1 !~ /[\sa-zA-Z]+\s<.*>/i) {
+				WARN("Space required between Full Name & Mail-id:\n" .
+					$herecurr);
+				}
+			}
 		}
 
 # Check for wrappage within a valid hunk of the file
-- 
1.7.0.4



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

* Re: PATCH] patch to generate warning when signed-of line in patch in not proper
       [not found] ` <BANLkTik2NVHNbG4mSZDWJ2Mt5i6AhGr+uw@mail.gmail.com>
@ 2011-05-21 16:03   ` Joe Perches
  0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2011-05-21 16:03 UTC (permalink / raw)
  To: anish singh; +Cc: man.k1983, davej, rostedt, apw, akpm, vapier, linux-kernel

On Sat, 2011-05-21 at 20:14 +0530, anish singh wrote:
> Re-sending to get some comments on this.
> 
> On Thu, May 19, 2011 at 10:53 PM, anish <anish198519851985@gmail.com>
> wrote:
>         From: anish kumar <anish198519851985@gmail.com>
>         
>         This patch generates warning when there is no space between
>         the
>         patch submitter name and successive mail-id.

If you do this, why not do it for all signature types?

our $Valid_Signatures "(?:Signed-off-by:|Reviewed-by:|Acked-by:)"

>         Signed-off-by: anish kumar <anish198519851985@gmail.com>
>         ---
>          scripts/checkpatch.pl |   10 ++++++++--
>          1 files changed, 8 insertions(+), 2 deletions(-)
>         
>         diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>         index d867081..437c6d4 100755
>         --- a/scripts/checkpatch.pl
>         +++ b/scripts/checkpatch.pl
>         @@ -1373,10 +1373,16 @@ sub process {
>                                        WARN("Signed-off-by: is the
>         preferred form\n" .
>                                                $herecurr);
>                                }
>         -                       if ($line =~ /^\s*signed-off-by:\S/i)
>         {
>         -                               WARN("space required after
>         Signed-off-by:\n" .

	if ($line =~ /^(\s*)($ValidSignatures)(\s*)(.*)$/i) {
		my $space_before = $1;
		my $sign_off = $2;
		my $space_after = $3;
		my $email = $4;
		if (defined $space_before && $space_before ne "") {
			warning (no space before...)
		}
		if ($sign_off !~ /$Valid_Signature/) {
			warning (signature case...)
		}
		if (!defined $space_after || $space_after ne " ") {
			warning (need only one space after colon...)
		}
		if (!validate_email($4)) {
			warning (bad email...)



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

* Re: PATCH] patch to generate warning when signed-of line in patch in not proper
  2011-05-21 19:38 anish
@ 2011-05-21 19:52 ` Joe Perches
  0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2011-05-21 19:52 UTC (permalink / raw)
  To: anish; +Cc: davej, rostedt, apw, akpm, vapier, linux-kernel, man.k1983

On Sun, 2011-05-22 at 01:08 +0530, anish wrote:
> On Sat, May 21, 2011 at 9:33 PM, Joe Perches <joe@perches.com> wrote:
> >>If you do this, why not do it for all signature types?
> >>our $Valid_Signatures "(?:Signed-off-by:|Reviewed-by:|Acked-by:)"
> Definitely.Please check below modified patch.
[]
> This patch generates warning when there is no space betweenthe  patch
> submitter name and successive mail-id.As suggested by
> Joe Perches(joe@perches.com) that we can do this for
> all signature types.

Typos and spacing issues in commit message.

> Signed-off-by: anish kumar <anish198519851985@gmail.com>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> +my $sign;
> +my @signs = ("Reviewed-by:","Acked-by:","Signed-off-by:","Tested-by:");
[]
> +#check the patch for a signoff/Reviewed/Acked/Tested:
> +        foreach $sign (@signs) {

It's inefficient to loop for this.
I think what I suggested is neater,
but what you're doing is OK.

Your email subject line should be more like:

[PATCH] checkpatch: More signature format verification

And when you revise patches, use some version number
in the [PATCH] block like:

[PATCH v2] checkpatch: etc...

cheers, Joe


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

* Re: PATCH] patch to generate warning when signed-of line in patch in not proper
@ 2011-05-21 19:38 anish
  2011-05-21 19:52 ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: anish @ 2011-05-21 19:38 UTC (permalink / raw)
  To: joe; +Cc: davej, rostedt, apw, akpm, vapier, linux-kernel, man.k1983

On Sat, May 21, 2011 at 9:33 PM, Joe Perches <joe@perches.com> wrote:

On Sat, 2011-05-21 at 20:14 +0530, anish singh wrote:
> Re-sending to get some comments on this.
>
> On Thu, May 19, 2011 at 10:53 PM, anish <anish198519851985@gmail.com>
> wrote:
>         From: anish kumar <anish198519851985@gmail.com>
>
>         This patch generates warning when there is no space between
>         the
>         patch submitter name and successive mail-id.


>>If you do this, why not do it for all signature types?

>>our $Valid_Signatures "(?:Signed-off-by:|Reviewed-by:|Acked-by:)"

Definitely.Please check below modified patch.

>         Signed-off-by: anish kumar <anish198519851985@gmail.com>
>         ---
>          scripts/checkpatch.pl |   10 ++++++++--
>          1 files changed, 8 insertions(+), 2 deletions(-)
>
>         diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>         index d867081..437c6d4 100755
>         --- a/scripts/checkpatch.pl
>         +++ b/scripts/checkpatch.pl
>         @@ -1373,10 +1373,16 @@ sub process {
>                                        WARN("Signed-off-by: is the
>         preferred form\n" .
>                                                $herecurr);
>                                }
>         -                       if ($line =~ /^\s*signed-off-by:\S/i)
>         {
>         -                               WARN("space required after
>         Signed-off-by:\n" .


>>       if ($line =~ /^(\s*)($ValidSignatures)(\s*)(.*)$/i) {
>>               my $space_before = $1;
>>               my $sign_off = $2;
>>               my $space_after = $3;
>>               my $email = $4;
>>               if (defined $space_before && $space_before ne "") {
>>                       warning (no space before...)
>>               }
>>               if ($sign_off !~ /$Valid_Signature/) {
>>                       warning (signature case...)
>>               }
>>               if (!defined $space_after || $space_after ne " ") {
>>                       warning (need only one space after colon...)
>>               }
>>               if (!validate_email($4)) {
>>                       warning (bad email...)

Please check the below patch.

--------------------------------------------------------------------------

From: anish kumar <anish198519851985@gmail.com>

This patch generates warning when there is no space betweenthe  patch
submitter name and successive mail-id.As suggested by
Joe Perches(joe@perches.com) that we can do this for
all signature types.

Signed-off-by: anish kumar <anish198519851985@gmail.com>
---
 scripts/checkpatch.pl |   38 ++++++++++++++++++++++++--------------
 1 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d867081..6d67a17 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -29,6 +29,8 @@ my $summary_file = 0;
 my $root;
 my %debug;
 my $help = 0;
+my $sign;
+my @signs = ("Reviewed-by:","Acked-by:","Signed-off-by:","Tested-by:");
 
 sub help {
 	my ($exitcode) = @_;
@@ -1365,20 +1367,27 @@ sub process {
 			}
 		}
 
-#check the patch for a signoff:
-		if ($line =~ /^\s*signed-off-by:/i) {
-			# This is a signoff, if ugly, so do not double report.
-			$signoff++;
-			if (!($line =~ /^\s*Signed-off-by:/)) {
-				WARN("Signed-off-by: is the preferred form\n" .
-					$herecurr);
-			}
-			if ($line =~ /^\s*signed-off-by:\S/i) {
-				WARN("space required after Signed-off-by:\n" .
-					$herecurr);
-			}
-		}
-
+#check the patch for a signoff/Reviewed/Acked/Tested:
+        foreach $sign (@signs) {
+                 if ($line =~ /^\s*$sign/i) {
+                        # This is a signoff, if ugly, so do not double report.
+                        $signoff++;
+                   if (!($line =~ /^\s*$sign/)) {
+                                WARN("$sign is the preferred form\n" .
+                                        $herecurr);
+                        }
+                     if ($line =~ /^\s*$sign(.*)/i) {
+                          if($1 !~ /^\s*(\s[a-zA-Z]*.*)/i) {
+                                WARN("Space required after $sign\n" .
+                                        $herecurr);
+                                  }
+                              if($1 !~ /[\sa-zA-Z]+\s<.*>/i) {
+                                   WARN("Space required b/w Full Name & Mail-id:\n" .
+                                        $herecurr);
+                                }
+                        }
+        }
+}
 # Check for wrappage within a valid hunk of the file
 		if ($realcnt != 0 && $line !~ m{^(?:\+|-| |\\ No newline|$)}) {
 			ERROR("patch seems to be corrupt (line wrapped?)\n" .
@@ -2964,3 +2973,4 @@ sub process {
 
 	return $clean;
 }
+
-- 
1.7.0.4



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

end of thread, other threads:[~2011-05-21 19:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-19 17:23 PATCH] patch to generate warning when signed-of line in patch in not proper anish
     [not found] ` <BANLkTik2NVHNbG4mSZDWJ2Mt5i6AhGr+uw@mail.gmail.com>
2011-05-21 16:03   ` Joe Perches
2011-05-21 19:38 anish
2011-05-21 19:52 ` Joe Perches

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).