lkml.org 
[lkml]   [2011]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[patch v3] checkpatch: Signature format verification
From
Date
From: anish kumar <anish198519851985@gmail.com>

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

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

V3 Modification:Moved the variable from global to local scope.

Signed-off-by: anish kumar <anish198519851985@gmail.com>
---
scripts/checkpatch.pl | 36 ++++++++++++++++++++++++------------
1 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d867081..fbc0e62 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1365,20 +1365,32 @@ 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:
+ my ($sign,$loop_brk);
+ my @signs = ("Reviewed-by:","Acked-by:","Signed-off-by:","Tested-by:");
+ 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($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



\
 
 \ /
  Last update: 2011-05-23 17:23    [from the cache]
©2003-2011 Jasper Spaans