History

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:".

Joe Perches committed 14 years ago

Commit 270c49a1 parent 96b62061 file · +5 −2Browse files

Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+5−2
@@ -1504,9 +1504,11 @@ sub process { · 1503 unmodified lines
15041504 if ($line =~ /^diff --git.*?(\S+)$/) {
15051505 $realfile = $1;
15061506 $realfile =~ s@^([^/]*)/@@;
1507+ $in_commit_log = 0;
15071508 } elsif ($line =~ /^\+\+\+\s+(\S+)/) {
15081509 $realfile = $1;
15091510 $realfile =~ s@^([^/]*)/@@;
1511+ $in_commit_log = 0;
15101512
15111513 $p1_prefix = $1;
15121514 if (!$file && $tree && $p1_prefix ne '' &&
@@ -1546,7 +1548,8 @@ sub process { · 33 unmodified lines
15461548 }
15471549
15481550 # Check signature styles
1549− if ($line =~ /^(\s*)($signature_tags)(\s*)(.*)/) {
1551+ if (!$in_header_lines &&
1552+ $line =~ /^(\s*)($signature_tags)(\s*)(.*)/) {
15501553 my $space_before = $1;
15511554 my $sign_off = $2;
15521555 my $space_after = $3;
@@ -1623,7 +1626,7 @@ sub process { · 70 unmodified lines
16231626 # Check if it's the start of a commit log
16241627 # (not a header line and we haven't seen the patch filename)
16251628 if ($in_header_lines && $realfile =~ /^$/ &&
1626− $rawline !~ /^(commit\b|from\b|\w+:).+$/i) {
1629+ $rawline !~ /^(commit\b|from\b|[\w-]+:).+$/i) {
16271630 $in_header_lines = 0;
16281631 $in_commit_log = 1;
16291632 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t