All of lore.kernel.org
 help / color / mirror / Atom feed
From: anish <anish198519851985@gmail.com>
To: joe@perches.com
Cc: davej@redhat.com, rostedt@goodmis.org, apw@shadowen.org,
	akpm@linux-foundation.org, vapier@gentoo.org,
	linux-kernel@vger.kernel.org, man.k1983@gmail.com
Subject: [patch v2] checkpatch: Signature format verification
Date: Sun, 22 May 2011 15:48:48 +0530	[thread overview]
Message-ID: <1306059528.2761.3.camel@anish-desktop> (raw)
In-Reply-To: <1306006721.1622.18.camel@anish-desktop>

From: anish kumar <anish198519851985@gmail.com>

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

Modification:Suggested by Joe Perches(joe@perches.com) that
we can add this check for all signature types so added that
change and added logic to remove the inefficent looping so
that it can come out as soon as signature type is matched.

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

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d867081..0622f41 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,$loop_brk);
+my @signs = ("Reviewed-by:","Acked-by:","Signed-off-by:","Tested-by:");
 
 sub help {
 	my ($exitcode) = @_;
@@ -1365,20 +1367,30 @@ 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" .
+#check the patch for a signoff/Reviewed/Acked/Tested:
+foreach $sign (@signs) {
+	$loop_brk=0;
+	if ($line =~ /^\s*$sign/i) {
+		# This is a signoff, if ugly, so do not double report.
+		$signoff++;
+		$loop_brk++;
+		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 ($line =~ /^\s*signed-off-by:\S/i) {
-				WARN("space required after Signed-off-by:\n" .
+			if($1 !~ /[\sa-zA-Z]+\s<.*>/i) {
+				WARN("Space required b/w Full Name & Mail-id:\n" .
 					$herecurr);
 			}
 		}
-
+	}
+last if ($loop_brk == 1);
+}
 # 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" .
-- 
1.7.0.4



  parent reply	other threads:[~2011-05-22 10:19 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-21 19:38 PATCH] patch to generate warning when signed-of line in patch in not proper anish
2011-05-21 19:52 ` Joe Perches
2011-05-22 10:18 ` anish [this message]
2011-05-22 14:16   ` [patch v2] checkpatch: Signature format verification Joe Perches
     [not found]     ` <BANLkTimMPvn87E0EEqT4vhox4_8nQ4pMug@mail.gmail.com>
2011-05-23  4:14       ` Joe Perches
2011-05-23 16:22         ` Steven Rostedt
2011-05-23 16:30           ` Joe Perches
2011-05-23 15:21   ` [patch v3] " anish
2011-05-23 16:11     ` Joe Perches
     [not found]       ` <BANLkTi=9nzMbxU0=P+pOaHcebqhL=bd2HQ@mail.gmail.com>
2011-05-23 16:36         ` Joe Perches
2011-05-23 16:39           ` Randy Dunlap
2011-05-23 16:42             ` Joe Perches
     [not found]               ` <BANLkTik8coVxt=Z92NQBNH_=4yRhTtexzA@mail.gmail.com>
2011-05-23 17:07                 ` Randy Dunlap
2011-05-23 17:18                 ` Joe Perches
     [not found]                   ` <BANLkTikqezyJMy1_i-woTVM9bvVL750iew@mail.gmail.com>
2011-05-23 18:09                     ` Joe Perches
2011-05-23 22:51                       ` Mike Frysinger
2011-05-24  1:24                         ` Valdis.Kletnieks
2011-05-24  1:31                           ` Mike Frysinger
2011-05-24  4:44                             ` Randy Dunlap
2011-05-27 18:01     ` [patch v4] " anish
2011-05-27 18:16       ` Steven Rostedt
2011-05-27 18:18         ` Randy Dunlap
2011-05-27 18:45         ` Joe Perches
2011-05-27 18:58           ` Joe Perches
2011-05-27 19:22           ` Steven Rostedt
2011-05-27 19:33             ` Joe Perches
2011-05-27 18:29       ` Joe Perches
     [not found]         ` <BANLkTikfh_ABGomn-Lm9Ugc7MzeRodwiEQ@mail.gmail.com>
2011-05-27 19:08           ` Joe Perches
     [not found]             ` <BANLkTi=JK+XS2D0exj=unjpjGCsnVncCzQ@mail.gmail.com>
2011-05-27 19:33               ` Joe Perches
     [not found]                 ` <BANLkTi=dsYi3ViZdpGdagxzhzDRuRVL_+A@mail.gmail.com>
2011-05-27 20:18                   ` Steven Rostedt
2011-05-27 20:37                     ` Joe Perches
     [not found]                     ` <BANLkTi=VuLpdAf3Qo3mo_nQ03yHazeHf+g@mail.gmail.com>
2011-05-28  1:42                       ` Joe Perches
2011-05-27 22:14       ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1306059528.2761.3.camel@anish-desktop \
    --to=anish198519851985@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@shadowen.org \
    --cc=davej@redhat.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=man.k1983@gmail.com \
    --cc=rostedt@goodmis.org \
    --cc=vapier@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.