aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2015-04-16 15:44:28 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-17 09:03:57 -0400
commit2a076f40d8c9be95bee7bcf18436655e1140447f (patch)
treee905ba409c28e126fea5f558e51eb52368a36ed5 /scripts/checkpatch.pl
parent0e212e0a720601fabda102f7998d27625f9e144a (diff)
checkpatch, SubmittingPatches: suggest line wrapping commit messages at 75 columns
Commit messages lines are sometimes overly long. Suggest line wrapping at 75 columns so the default git commit log indentation of 4 plus the commit message text still fits on an 80 column screen. Add a checkpatch test for long commit messages lines too. Signed-off-by: Joe Perches <joe@perches.com> Cc: David Miller <davem@davemloft.net> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Ian Morris <ipm@chirality.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl9
1 files changed, 9 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index c72e7ee1000b..9a8b2bd14dc2 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1898,6 +1898,7 @@ sub process {
1898 1898
1899 my $in_header_lines = $file ? 0 : 1; 1899 my $in_header_lines = $file ? 0 : 1;
1900 my $in_commit_log = 0; #Scanning lines before patch 1900 my $in_commit_log = 0; #Scanning lines before patch
1901 my $commit_log_long_line = 0;
1901 my $reported_maintainer_file = 0; 1902 my $reported_maintainer_file = 0;
1902 my $non_utf8_charset = 0; 1903 my $non_utf8_charset = 0;
1903 1904
@@ -2233,6 +2234,14 @@ sub process {
2233 "Remove Gerrit Change-Id's before submitting upstream.\n" . $herecurr); 2234 "Remove Gerrit Change-Id's before submitting upstream.\n" . $herecurr);
2234 } 2235 }
2235 2236
2237# Check for line lengths > 75 in commit log, warn once
2238 if ($in_commit_log && !$commit_log_long_line &&
2239 length($line) > 75) {
2240 WARN("COMMIT_LOG_LONG_LINE",
2241 "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr);
2242 $commit_log_long_line = 1;
2243 }
2244
2236# Check for git id commit length and improperly formed commit descriptions 2245# Check for git id commit length and improperly formed commit descriptions
2237 if ($in_commit_log && $line =~ /\b(c)ommit\s+([0-9a-f]{5,})/i) { 2246 if ($in_commit_log && $line =~ /\b(c)ommit\s+([0-9a-f]{5,})/i) {
2238 my $init_char = $1; 2247 my $init_char = $1;