Commit bf4daf12 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

checkpatch: avoid some commit message long line warnings

Fixes: and Link: lines may exceed 75 chars in the commit log.

So too can stack dump and dmesg lines and lines that seem
like filenames.

And Fixes: lines don't need to have a "commit" prefix before the
commit id.

Add exceptions for these types of lines.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Reported-by: default avatarPaul Bolle <pebolle@tiscali.nl>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 6e300757
...@@ -1953,9 +1953,9 @@ sub process { ...@@ -1953,9 +1953,9 @@ sub process {
our $clean = 1; our $clean = 1;
my $signoff = 0; my $signoff = 0;
my $is_patch = 0; my $is_patch = 0;
my $in_header_lines = $file ? 0 : 1; my $in_header_lines = $file ? 0 : 1;
my $in_commit_log = 0; #Scanning lines before patch my $in_commit_log = 0; #Scanning lines before patch
my $commit_log_possible_stack_dump = 0;
my $commit_log_long_line = 0; my $commit_log_long_line = 0;
my $commit_log_has_diff = 0; my $commit_log_has_diff = 0;
my $reported_maintainer_file = 0; my $reported_maintainer_file = 0;
...@@ -2314,16 +2314,40 @@ sub process { ...@@ -2314,16 +2314,40 @@ sub process {
# Check for line lengths > 75 in commit log, warn once # Check for line lengths > 75 in commit log, warn once
if ($in_commit_log && !$commit_log_long_line && if ($in_commit_log && !$commit_log_long_line &&
length($line) > 75) { length($line) > 75 &&
!($line =~ /^\s*[a-zA-Z0-9_\/\.]+\s+\|\s+\d+/ ||
# file delta changes
$line =~ /^\s*(?:[\w\.\-]+\/)++[\w\.\-]+:/ ||
# filename then :
$line =~ /^\s*(?:Fixes:|Link:)/i ||
# A Fixes: or Link: line
$commit_log_possible_stack_dump)) {
WARN("COMMIT_LOG_LONG_LINE", WARN("COMMIT_LOG_LONG_LINE",
"Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr); "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr);
$commit_log_long_line = 1; $commit_log_long_line = 1;
} }
# Check if the commit log is in a possible stack dump
if ($in_commit_log && !$commit_log_possible_stack_dump &&
($line =~ /^\s*(?:WARNING:|BUG:)/ ||
$line =~ /^\s*\[\s*\d+\.\d{6,6}\s*\]/ ||
# timestamp
$line =~ /^\s*\[\<[0-9a-fA-F]{8,}\>\]/)) {
# stack dump address
$commit_log_possible_stack_dump = 1;
}
# Reset possible stack dump if a blank line is found
if ($in_commit_log && $commit_log_possible_stack_dump &&
$line =~ /^\s*$/) {
$commit_log_possible_stack_dump = 0;
}
# Check for git id commit length and improperly formed commit descriptions # Check for git id commit length and improperly formed commit descriptions
if ($in_commit_log && if ($in_commit_log &&
($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i || ($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||
$line =~ /\b[0-9a-f]{12,40}\b/i)) { ($line =~ /\b[0-9a-f]{12,40}\b/i &&
$line !~ /\bfixes:\s*[0-9a-f]{12,40}/i))) {
my $init_char = "c"; my $init_char = "c";
my $orig_commit = ""; my $orig_commit = "";
my $short = 1; my $short = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment