Martin Roth has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/63029 )
Change subject: util/lint/checkpatch: Update commit message & subject line limits ......................................................................
util/lint/checkpatch: Update commit message & subject line limits
The commit message has a (soft) line length limit of 72 characters and the subject has a (soft) line limit of 65 characters. This change updates checkpatch to warn at those limits.
Note that neither of these are hard limits because git & gerrit can both handle longer lines, it just doesn't look good.
Change-Id: I4ef131a65254e2b184b05e0215969aef97e12712 Signed-off-by: Martin Roth martin@coreboot.org --- M util/lint/checkpatch.pl 1 file changed, 15 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/29/63029/1
diff --git a/util/lint/checkpatch.pl b/util/lint/checkpatch.pl index 3cf249c..9355186 100755 --- a/util/lint/checkpatch.pl +++ b/util/lint/checkpatch.pl @@ -2265,7 +2265,6 @@ my $in_commit_log = 0; #Scanning lines before patch my $has_commit_log = 0; #Encountered lines before patch my $commit_log_possible_stack_dump = 0; - my $commit_log_long_line = 0; my $commit_log_has_diff = 0; my $reported_maintainer_file = 0; my $non_utf8_charset = 0; @@ -2658,10 +2657,9 @@ $commit_log_possible_stack_dump = 1; }
-# coreboot: The line lengeth limit is 72 -# Check for line lengths > 72 in commit log, warn once - if ($in_commit_log && !$commit_log_long_line && - length($line) > 72 && +# coreboot: The line length limit is 72 +# Check for line lengths > 72 in commit log + if ($in_commit_log && length($line) > 72 && !($line =~ /^\s*[a-zA-Z0-9_/.]+\s+|\s+\d+/ || # file delta changes $line =~ /^\s*(?:[\w.-+]*/)++[\w.-+]+:/ || @@ -2671,7 +2669,18 @@ $commit_log_possible_stack_dump)) { WARN("COMMIT_LOG_LONG_LINE", "Possible unwrapped commit description (prefer a maximum 72 chars per line)\n" . $herecurr); - $commit_log_long_line = 1; + } + +# coreboot: The line subject limit is 65 +# Check for line lengths > 65 in commit subject + if ($in_header_lines && + $line =~ /^Subject: /) { + $line = $line.$rawlines[$linenr]; + $line =~ s/^Subject: [PATCH] //; + if (length($line) > 65) { + WARN("COMMIT_LOG_LONG_LINE", + "Possible long commit subject (prefer a maximum 65 characters)\n" . $herecurr); + } }
# Reset possible stack dump if a blank line is found