Including BUG and stack dumps in commit logs makes checkpatch produce some false positive warning messages. checkpatch has multiple types of false positives: o Commit message lines > 75 chars o Stack dump address are mistaken for git commit IDs o Link: and Fixes: lines are allowed to be > 75 chars. o Fixes: style doesn't require ("<commit_description>") parentheses and double quotes like other uses of git commit ID and description. Fix these. Miscellanea: o Move the test for checking $commit_log_possible_stack_dump above the test for a long line commit message o Add test for hex address surrounded by square or angle brackets
Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all
Unified · Split
| @@ -2313,42 +2313,43 @@ sub process { · 2312 unmodified lines | |||
| 2313 | "Remove Gerrit Change-Id's before submitting upstream.\n" . $herecurr); | 2313 | "Remove Gerrit Change-Id's before submitting upstream.\n" . $herecurr); |
| 2314 | } | 2314 | } |
| 2315 | 2315 | ||
| 2316 | # Check if the commit log is in a possible stack dump | ||
| 2317 | if ($in_commit_log && !$commit_log_possible_stack_dump && | ||
| 2318 | ($line =~ /^\s*(?:WARNING:|BUG:)/ || | ||
| 2319 | $line =~ /^\s*\[\s*\d+\.\d{6,6}\s*\]/ || | ||
| 2320 | # timestamp | ||
| 2321 | $line =~ /^\s*\[\<[0-9a-fA-F]{8,}\>\]/)) { | ||
| 2322 | # stack dump address | ||
| 2323 | $commit_log_possible_stack_dump = 1; | ||
| 2324 | } | ||
| 2325 | |||
| 2316 | # Check for line lengths > 75 in commit log, warn once | 2326 | # Check for line lengths > 75 in commit log, warn once |
| 2317 | if ($in_commit_log && !$commit_log_long_line && | 2327 | if ($in_commit_log && !$commit_log_long_line && |
| 2318 | length($line) > 75 && | 2328 | length($line) > 75 && |
| 2319 | !($line =~ /^\s*[a-zA-Z0-9_\/\.]+\s+\|\s+\d+/ || | 2329 | !($line =~ /^\s*[a-zA-Z0-9_\/\.]+\s+\|\s+\d+/ || |
| 2320 | # file delta changes | 2330 | # file delta changes |
| 2321 | $line =~ /^\s*(?:[\w\.\-]+\/)++[\w\.\-]+:/ || | 2331 | $line =~ /^\s*(?:[\w\.\-]+\/)++[\w\.\-]+:/ || |
| 2322 | # filename then : | 2332 | # filename then : |
| 2323 | $line =~ /^\s*(?:Fixes:|Link:)/i || | 2333 | $line =~ /^\s*(?:Fixes:|Link:)/i || |
| 2324 | # A Fixes: or Link: line | 2334 | # A Fixes: or Link: line |
| 2325 | $commit_log_possible_stack_dump)) { | 2335 | $commit_log_possible_stack_dump)) { |
| 2326 | WARN("COMMIT_LOG_LONG_LINE", | 2336 | WARN("COMMIT_LOG_LONG_LINE", |
| 2327 | "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr); | 2337 | "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr); |
| 2328 | $commit_log_long_line = 1; | 2338 | $commit_log_long_line = 1; |
| 2329 | } | 2339 | } |
| 2330 | 2340 | ||
| 2331 | # Check if the commit log is in a possible stack dump | ||
| 2332 | if ($in_commit_log && !$commit_log_possible_stack_dump && | ||
| 2333 | ($line =~ /^\s*(?:WARNING:|BUG:)/ || | ||
| 2334 | $line =~ /^\s*\[\s*\d+\.\d{6,6}\s*\]/ || | ||
| 2335 | # timestamp | ||
| 2336 | $line =~ /^\s*\[\<[0-9a-fA-F]{8,}\>\]/)) { | ||
| 2337 | # stack dump address | ||
| 2338 | $commit_log_possible_stack_dump = 1; | ||
| 2339 | } | ||
| 2340 | |||
| 2341 | # Reset possible stack dump if a blank line is found | 2341 | # Reset possible stack dump if a blank line is found |
| 2342 | if ($in_commit_log && $commit_log_possible_stack_dump && | 2342 | if ($in_commit_log && $commit_log_possible_stack_dump && |
| 2343 | $line =~ /^\s*$/) { | 2343 | $line =~ /^\s*$/) { |
| 2344 | $commit_log_possible_stack_dump = 0; | 2344 | $commit_log_possible_stack_dump = 0; |
| 2345 | } | 2345 | } |
| 2346 | 2346 | ||
| 2347 | # Check for git id commit length and improperly formed commit descriptions | 2347 | # Check for git id commit length and improperly formed commit descriptions |
| 2348 | if ($in_commit_log && | 2348 | if ($in_commit_log && !$commit_log_possible_stack_dump && |
| 2349 | ($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i || | 2349 | ($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i || |
| 2350 | ($line =~ /\b[0-9a-f]{12,40}\b/i && | 2350 | ($line =~ /\b[0-9a-f]{12,40}\b/i && |
| 2351 | $line !~ /\bfixes:\s*[0-9a-f]{12,40}/i))) { | 2351 | $line !~ /[\<\[][0-9a-f]{12,40}[\>\]]/i && |
| 2352 | $line !~ /\bfixes:\s*[0-9a-f]{12,40}/i))) { | ||
| 2352 | my $init_char = "c"; | 2353 | my $init_char = "c"; |
| 2353 | my $orig_commit = ""; | 2354 | my $orig_commit = ""; |
| 2354 | my $short = 1; | 2355 | my $short = 1; |