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.
Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all
Unified · Split
| @@ -1953,9 +1953,9 @@ sub process { · 1952 unmodified lines | |||
| 1953 | our $clean = 1; | 1953 | our $clean = 1; |
| 1954 | my $signoff = 0; | 1954 | my $signoff = 0; |
| 1955 | my $is_patch = 0; | 1955 | my $is_patch = 0; |
| 1956 | |||
| 1957 | my $in_header_lines = $file ? 0 : 1; | 1956 | my $in_header_lines = $file ? 0 : 1; |
| 1958 | my $in_commit_log = 0; #Scanning lines before patch | 1957 | my $in_commit_log = 0; #Scanning lines before patch |
| 1958 | my $commit_log_possible_stack_dump = 0; | ||
| 1959 | my $commit_log_long_line = 0; | 1959 | my $commit_log_long_line = 0; |
| 1960 | my $commit_log_has_diff = 0; | 1960 | my $commit_log_has_diff = 0; |
| 1961 | my $reported_maintainer_file = 0; | 1961 | my $reported_maintainer_file = 0; |
| @@ -2314,16 +2314,40 @@ sub process { · 352 unmodified lines | |||
| 2314 | 2314 | ||
| 2315 | # Check for line lengths > 75 in commit log, warn once | 2315 | # Check for line lengths > 75 in commit log, warn once |
| 2316 | if ($in_commit_log && !$commit_log_long_line && | 2316 | if ($in_commit_log && !$commit_log_long_line && |
| 2317 | length($line) > 75) { | 2317 | length($line) > 75 && |
| 2318 | !($line =~ /^\s*[a-zA-Z0-9_\/\.]+\s+\|\s+\d+/ || | ||
| 2319 | # file delta changes | ||
| 2320 | $line =~ /^\s*(?:[\w\.\-]+\/)++[\w\.\-]+:/ || | ||
| 2321 | # filename then : | ||
| 2322 | $line =~ /^\s*(?:Fixes:|Link:)/i || | ||
| 2323 | # A Fixes: or Link: line | ||
| 2324 | $commit_log_possible_stack_dump)) { | ||
| 2318 | WARN("COMMIT_LOG_LONG_LINE", | 2325 | WARN("COMMIT_LOG_LONG_LINE", |
| 2319 | "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr); | 2326 | "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr); |
| 2320 | $commit_log_long_line = 1; | 2327 | $commit_log_long_line = 1; |
| 2321 | } | 2328 | } |
| 2322 | 2329 | ||
| 2330 | # Check if the commit log is in a possible stack dump | ||
| 2331 | if ($in_commit_log && !$commit_log_possible_stack_dump && | ||
| 2332 | ($line =~ /^\s*(?:WARNING:|BUG:)/ || | ||
| 2333 | $line =~ /^\s*\[\s*\d+\.\d{6,6}\s*\]/ || | ||
| 2334 | # timestamp | ||
| 2335 | $line =~ /^\s*\[\<[0-9a-fA-F]{8,}\>\]/)) { | ||
| 2336 | # stack dump address | ||
| 2337 | $commit_log_possible_stack_dump = 1; | ||
| 2338 | } | ||
| 2339 | |||
| 2340 | # Reset possible stack dump if a blank line is found | ||
| 2341 | if ($in_commit_log && $commit_log_possible_stack_dump && | ||
| 2342 | $line =~ /^\s*$/) { | ||
| 2343 | $commit_log_possible_stack_dump = 0; | ||
| 2344 | } | ||
| 2345 | |||
| 2323 | # Check for git id commit length and improperly formed commit descriptions | 2346 | # Check for git id commit length and improperly formed commit descriptions |
| 2324 | if ($in_commit_log && | 2347 | if ($in_commit_log && |
| 2325 | ($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i || | 2348 | ($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i || |
| 2326 | $line =~ /\b[0-9a-f]{12,40}\b/i)) { | 2349 | ($line =~ /\b[0-9a-f]{12,40}\b/i && |
| 2350 | $line !~ /\bfixes:\s*[0-9a-f]{12,40}/i))) { | ||
| 2327 | my $init_char = "c"; | 2351 | my $init_char = "c"; |
| 2328 | my $orig_commit = ""; | 2352 | my $orig_commit = ""; |
| 2329 | my $short = 1; | 2353 | my $short = 1; |