summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Roth <martin@coreboot.org>2022-03-22 16:24:44 -0600
committerFelix Held <felix-coreboot@felixheld.de>2022-03-25 19:23:59 +0000
commit10d34b7818350ed5b7c857c96439755a73f9218d (patch)
treec3fb8aaa792ad88b8af0e0e5fa5702ddb1f94628
parent135f9eb46acdf6ff8de332fd47967dd15128fdbf (diff)
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> Reviewed-on: https://review.coreboot.org/c/coreboot/+/63029 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Reviewed-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-by: Felix Singer <felixsinger@posteo.net>
-rwxr-xr-xutil/lint/checkpatch.pl21
1 files changed, 15 insertions, 6 deletions
diff --git a/util/lint/checkpatch.pl b/util/lint/checkpatch.pl
index 3cf249c4ed..93551862b2 100755
--- a/util/lint/checkpatch.pl
+++ b/util/lint/checkpatch.pl
@@ -2265,7 +2265,6 @@ sub process {
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 @@ sub process {
$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 @@ sub process {
$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