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>
This commit is contained in:
@@ -2265,7 +2265,6 @@ sub process {
|
|||||||
my $in_commit_log = 0; #Scanning lines before patch
|
my $in_commit_log = 0; #Scanning lines before patch
|
||||||
my $has_commit_log = 0; #Encountered lines before patch
|
my $has_commit_log = 0; #Encountered lines before patch
|
||||||
my $commit_log_possible_stack_dump = 0;
|
my $commit_log_possible_stack_dump = 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;
|
||||||
my $non_utf8_charset = 0;
|
my $non_utf8_charset = 0;
|
||||||
@@ -2658,10 +2657,9 @@ sub process {
|
|||||||
$commit_log_possible_stack_dump = 1;
|
$commit_log_possible_stack_dump = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# coreboot: The line lengeth limit is 72
|
# coreboot: The line length limit is 72
|
||||||
# Check for line lengths > 72 in commit log, warn once
|
# Check for line lengths > 72 in commit log
|
||||||
if ($in_commit_log && !$commit_log_long_line &&
|
if ($in_commit_log && length($line) > 72 &&
|
||||||
length($line) > 72 &&
|
|
||||||
!($line =~ /^\s*[a-zA-Z0-9_\/\.]+\s+\|\s+\d+/ ||
|
!($line =~ /^\s*[a-zA-Z0-9_\/\.]+\s+\|\s+\d+/ ||
|
||||||
# file delta changes
|
# file delta changes
|
||||||
$line =~ /^\s*(?:[\w\.\-\+]*\/)++[\w\.\-\+]+:/ ||
|
$line =~ /^\s*(?:[\w\.\-\+]*\/)++[\w\.\-\+]+:/ ||
|
||||||
@@ -2671,7 +2669,18 @@ sub process {
|
|||||||
$commit_log_possible_stack_dump)) {
|
$commit_log_possible_stack_dump)) {
|
||||||
WARN("COMMIT_LOG_LONG_LINE",
|
WARN("COMMIT_LOG_LONG_LINE",
|
||||||
"Possible unwrapped commit description (prefer a maximum 72 chars per line)\n" . $herecurr);
|
"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
|
# Reset possible stack dump if a blank line is found
|
||||||
|
Reference in New Issue
Block a user