summaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2012-01-10 15:09:50 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-10 16:30:50 -0800
commit270c49a088ae58d4b817861bb04bfec63b0966db (patch)
tree4c08b86b0be13a7d256e1f7a83f87ebca9d20b9d /scripts/checkpatch.pl
parent96b62067f970ff529c98913311d33f4b57b453dc (diff)
downloadlinux-270c49a088ae58d4b817861bb04bfec63b0966db.tar.bz2
checkpatch: update signature "might be better as" warning
email header lines can look like signature tags. It's valid to have multiple email recipients on a single line but not valid to have multiple signatures on a single line. Validate signatures only when not in the email headers. Clear the $in_commit_log flag when the patch filename appears. Add '-' to the valid chars in a message header for headers like "Message-Id:" and "In-Reply-To:". Signed-off-by: Joe Perches <joe@perches.com> Reported-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl7
1 files changed, 5 insertions, 2 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 8fda3b3f7be8..885e3b43d64a 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1504,9 +1504,11 @@ sub process {
if ($line =~ /^diff --git.*?(\S+)$/) {
$realfile = $1;
$realfile =~ s@^([^/]*)/@@;
+ $in_commit_log = 0;
} elsif ($line =~ /^\+\+\+\s+(\S+)/) {
$realfile = $1;
$realfile =~ s@^([^/]*)/@@;
+ $in_commit_log = 0;
$p1_prefix = $1;
if (!$file && $tree && $p1_prefix ne '' &&
@@ -1546,7 +1548,8 @@ sub process {
}
# Check signature styles
- if ($line =~ /^(\s*)($signature_tags)(\s*)(.*)/) {
+ if (!$in_header_lines &&
+ $line =~ /^(\s*)($signature_tags)(\s*)(.*)/) {
my $space_before = $1;
my $sign_off = $2;
my $space_after = $3;
@@ -1623,7 +1626,7 @@ sub process {
# Check if it's the start of a commit log
# (not a header line and we haven't seen the patch filename)
if ($in_header_lines && $realfile =~ /^$/ &&
- $rawline !~ /^(commit\b|from\b|\w+:).+$/i) {
+ $rawline !~ /^(commit\b|from\b|[\w-]+:).+$/i) {
$in_header_lines = 0;
$in_commit_log = 1;
}