lkml.org 
[lkml]   [2011]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [patch v4] checkpatch: Signature format verification
From
Date
On Fri, 2011-05-27 at 16:18 -0400, Steven Rostedt wrote:
> On Sat, 2011-05-28 at 01:24 +0530, anish singh wrote:
> > Anish, do you have a response to this?
> > Your approach is correct but i am trying to do in my own way.
> Why?? Correct is more important than individual preferences.

Thanks Steven, I was about to write something similar.

[]
> > In this if loop again i am catching name & rest of the things in $1.
> > $1 will be used for checking space between name & mail-id.
> BTW, people hate perl for this very reason. This subtle changing of $1
> is very hard to follow if you are not a perl expert. I use perl all the
> time (recordmcount.pl and ktest.pl), but if you look at my code, you
> will see that I purposely avoid these subtle characteristics of perl,
> because that's the (very rightfully so) reason people complain that perl
> is a write once and never maintain language.

I'm not a perl geek, nor do I want to be, but
that's exactly why I suggested after Anish's
first attempt something I think reasonably clear
and straightforward which avoids any reuse of $n.

Anish, please use this style.

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($email)) {
warning (bad email...)
}
}



\
 
 \ /
  Last update: 2011-05-27 22:41    [W:0.092 / U:0.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site