From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753411AbbDAUd2 (ORCPT ); Wed, 1 Apr 2015 16:33:28 -0400 Received: from smtprelay0223.hostedemail.com ([216.40.44.223]:43973 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752559AbbDAUd1 (ORCPT ); Wed, 1 Apr 2015 16:33:27 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::,RULES_HIT:41:355:379:541:800:960:968:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2197:2199:2393:2538:2553:2559:2562:2693:2828:3138:3139:3140:3141:3142:3354:3653:3865:3866:3867:3868:3870:3872:3873:3874:4321:4605:5007:6261:8531:8957:10004:10400:10848:10967:11026:11232:11473:11639:11658:11914:12043:12438:12517:12519:12555:12663:12740:13018:13019:13095:13255:14394:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: smell90_3ad4aa4a3794c X-Filterd-Recvd-Size: 4033 Message-ID: <1427920401.31790.91.camel@perches.com> Subject: [PATCH V2] checkpatch/SubmittingPatches: Suggest line wrapping commit messages at 75 columns From: Joe Perches To: Andrew Morton Cc: Jonathan Corbet , David Miller , Ian Morris , netdev@vger.kernel.org, LKML , linux-doc Date: Wed, 01 Apr 2015 13:33:21 -0700 In-Reply-To: <20150401131824.efafdf9c97188f97cb4a212c@linux-foundation.org> References: <1427634005-4313-1-git-send-email-ipm@chirality.org.uk> <20150331.135338.519327316482059081.davem@davemloft.net> <1427825806.10376.42.camel@perches.com> <1427827225.18175.3.camel@perches.com> <20150401122001.f0203b0ddac348db14e5822a@linux-foundation.org> <20150401213618.029f8c1f@lwn.net> <1427918969.31790.78.camel@perches.com> <20150401131824.efafdf9c97188f97cb4a212c@linux-foundation.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Acked-by: David Miller --- V2: avoid Andrew Morton's colicky crying binges... On Wed, 2015-04-01 at 13:18 -0700, Andrew Morton wrote: > On Wed, 01 Apr 2015 13:09:29 -0700 Joe Perches wrote: > I'm very sensitive. A poet too no doubt. > > git log has a default 4 space indent of the commit message so > > 75 or 76 would still fit an 80 column screen. > > That's a good point. Good enough to be in a changelog ;) If you're going to change it, make sure to DTRT. Or just take this one... Documentation/SubmittingPatches | 4 ++-- scripts/checkpatch.pl | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches index 447671b..c9de1c3 100644 --- a/Documentation/SubmittingPatches +++ b/Documentation/SubmittingPatches @@ -614,8 +614,8 @@ The canonical patch message body contains the following: - An empty line. - - The body of the explanation, which will be copied to the - permanent changelog to describe this patch. + - The body of the explanation, line wrapped at 75 columns, which will + be copied to the permanent changelog to describe this patch. - The "Signed-off-by:" lines, described above, which will also go in the changelog. diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index d54a814..62a7be5 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1898,6 +1898,7 @@ sub process { my $in_header_lines = $file ? 0 : 1; my $in_commit_log = 0; #Scanning lines before patch + my $commit_log_long_line = 0; my $reported_maintainer_file = 0; my $non_utf8_charset = 0; @@ -2233,6 +2234,14 @@ sub process { "Remove Gerrit Change-Id's before submitting upstream.\n" . $herecurr); } +# Check for line lengths > 75 in commit log, warn once + if ($in_commit_log && !$commit_log_long_line && + length($line) > 75) { + WARN("COMMIT_LOG_LONG_LINE", + "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr); + $commit_log_long_line = 1; + } + # Check for git id commit length and improperly formed commit descriptions if ($in_commit_log && $line =~ /\b(c)ommit\s+([0-9a-f]{5,})/i) { my $init_char = $1;