From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752064AbbGaWyl (ORCPT ); Fri, 31 Jul 2015 18:54:41 -0400 Received: from smtprelay0159.hostedemail.com ([216.40.44.159]:40557 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751614AbbGaWyk (ORCPT ); Fri, 31 Jul 2015 18:54:40 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:355:379:541:800:960:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1543:1593:1594:1711:1730:1747:1777:1792:1801:2393:2553:2559:2562:2828:2902:3138:3139:3140:3141:3142:3354:3653:3865:3866:3867:3868:3870:3871:3874:4321:4605:5007:6261:7903:8531:9121:9592:10004:10400:10848:11026:11473:11658:11914:12043:12291:12438:12517:12519:12555:12679:12683:13208:13229:14093:14097:14110:14394:21067:21080:21212,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: cakes99_287cfea02b107 X-Filterd-Recvd-Size: 4040 Message-ID: <1438383270.1301.3.camel@perches.com> Subject: [PATCH] checkpatch: Avoid some commit message long line warnings From: Joe Perches To: Paul Bolle , Andrew Morton Cc: Andy Whitcroft , linux-kernel@vger.kernel.org Date: Fri, 31 Jul 2015 15:54:30 -0700 In-Reply-To: <1438345486.13223.19.camel@tiscali.nl> References: <1438345486.13223.19.camel@tiscali.nl> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.16.0-fta1 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 Fixes: and Link: lines may exceed 75 chars in the commit log. So too can stack dump and dmesg lines and lines that seem like filenames. And Fixes: lines don't need to have a "commit" prefix before the commit id. Add exceptions for these types of lines. Noticed-by: Paul Bolle Signed-off-by: Joe Perches --- scripts/checkpatch.pl | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 50693f5..4b71ab0 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1953,9 +1953,9 @@ sub process { our $clean = 1; my $signoff = 0; my $is_patch = 0; - my $in_header_lines = $file ? 0 : 1; my $in_commit_log = 0; #Scanning 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; @@ -2314,16 +2314,40 @@ sub process { # Check for line lengths > 75 in commit log, warn once if ($in_commit_log && !$commit_log_long_line && - length($line) > 75) { + length($line) > 75 && + !($line =~ /^\s*[a-zA-Z0-9_\/\.]+\s+\|\s+\d+/ || + # file delta changes + $line =~ /^\s*(?:[\w\.\-]+\/)++[\w\.\-]+:/ || + # filename then : + $line =~ /^\s*(?:Fixes:|Link:)/i || + # A Fixes: or Link: line + $commit_log_possible_stack_dump)) { WARN("COMMIT_LOG_LONG_LINE", "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr); $commit_log_long_line = 1; } +# Check if the commit log is in a possible stack dump + if ($in_commit_log && !$commit_log_possible_stack_dump && + ($line =~ /^\s*(?:WARNING:|BUG:)/ || + $line =~ /^\s*\[\s*\d+\.\d{6,6}\s*\]/ || + # timestamp + $line =~ /^\s*\[\<[0-9a-fA-F]{8,}\>\]/)) { + # stack dump address + $commit_log_possible_stack_dump = 1; + } + +# Reset possible stack dump if a blank line is found + if ($in_commit_log && $commit_log_possible_stack_dump && + $line =~ /^\s*$/) { + $commit_log_possible_stack_dump = 0; + } + # Check for git id commit length and improperly formed commit descriptions if ($in_commit_log && ($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i || - $line =~ /\b[0-9a-f]{12,40}\b/i)) { + ($line =~ /\b[0-9a-f]{12,40}\b/i && + $line !~ /\bfixes:\s*[0-9a-f]{12,40}/i))) { my $init_char = "c"; my $orig_commit = ""; my $short = 1;