Re: [patch v4] checkpatch: Signature format verification

From: Joe Perches
Date: Fri May 27 2011 - 16:37:50 EST


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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/