Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp57680imm; Fri, 13 Jul 2018 17:11:19 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeiGVHQ+EXesVlsO/9CWr1pdlSsSZdmj0d3y0eyjB9euQrCpIuY7TcXN5+EXriSGKs4iiER X-Received: by 2002:a63:4f1a:: with SMTP id d26-v6mr8069142pgb.121.1531527079034; Fri, 13 Jul 2018 17:11:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531527079; cv=none; d=google.com; s=arc-20160816; b=SAzeUZSb2hjBAg27qPsVt+jYH8ZGrbkDFEeRkfmHWeL7DEHprnqK80kIaFlCfvaeav 3CpqRiypgCjmGFY53IT22INvGGso9twM5S/s3Pzs1pjH/Iq67BjgdvgkMfVeHj+HqdTw Fft8wE0V5sIz5/uWPmPmgUVZuPpSwLsglDJYoJsJG8nvwiiOJb3xi0P/xJA5tOiStH8Z Dm6cl2BZ7xMIqCjifD5mWLOkWVuC4uWeTgZ/ytMiBXOiIk6K4HFRF00xao7VlaLdQo1i HBAHZNAIyK29MPwlf9oqxno1n95VPhcDtRyVvf0cyk07m9UipZqJxmYRX6yV0ZgUf/Gp Bpow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=1RII+4MQy/jtI0DGPympHlZi3WlHz0zDVAH08oAGCOc=; b=AoBbyKO1nd3iS6cBJesYkYAcmHObLmZmPU937/iU0IF4gpT3vDgjML7UtGJ3/k+9j5 siGJ2nd7cvdpFNjt12WjJM0rfKgM9raqLlD8SFi8krVGf0EQsUqhnUPS0UEbp/83X0aq Q2xWfRtkQzx+b0vTq+sw9nFf7QorWzpGP1K2aiV4nXwgTmatFAF2Rfpulvy79YFIfeOe L1HKCDe8CILsPTtlKM2J3pMk9AoC7/NPUxGv3WG67JelDOlCSiNMN5jDd/TyGSivRP0Y 0EpD4/fLSo5/oObhZPozHE+gr4k4X0zxZ2xtFWZUDOTtmQFX25ccQ+2RYNGI5eLdvrya c9VA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m7-v6si1032590pgm.184.2018.07.13.17.10.51; Fri, 13 Jul 2018 17:11:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731966AbeGNAZf (ORCPT + 99 others); Fri, 13 Jul 2018 20:25:35 -0400 Received: from smtprelay0105.hostedemail.com ([216.40.44.105]:50469 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731021AbeGNAZf (ORCPT ); Fri, 13 Jul 2018 20:25:35 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay06.hostedemail.com (Postfix) with ESMTP id 3F9F318014AE5; Sat, 14 Jul 2018 00:08:40 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2553:2559:2562:2828:2915:3138:3139:3140:3141:3142:3355:3622:3653:3865:3866:3867:3868:3870:3871:3872:3874:4321:5007:6119:7903:10004:10400:10848:11026:11232:11658:11914:12043:12438:12555:12740:12760:12895:13439:14181:14659:14721:21060:21080:21433:21451:21627:21740:30022:30034:30054:30069:30070:30090:30091,0,RBL:47.151.153.53:@perches.com:.lbl8.mailshell.net-62.8.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:26,LUA_SUMMARY:none X-HE-Tag: bed23_85b13cc47b257 X-Filterd-Recvd-Size: 3981 Received: from XPS-9350.home (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf01.hostedemail.com (Postfix) with ESMTPA; Sat, 14 Jul 2018 00:08:38 +0000 (UTC) Message-ID: <50a05aaf44e5f86cbf687863dadaa26b45debe2d.camel@perches.com> Subject: Re: [PATCH] checkpatch: Require commit text and warn on long commit text lines From: Joe Perches To: pheragu@codeaurora.org, Andrew Morton , Greg KH Cc: apw@canonical.com, linux-kernel@vger.kernel.org, tsoni@codeaurora.org, bryanh@codeaurora.org, ckadabi@codeaurora.org, David Keitel Date: Fri, 13 Jul 2018 17:08:37 -0700 In-Reply-To: <6ed46f85a7577e1d4a48e81f67fd7581@codeaurora.org> References: <1531518027-13318-1-git-send-email-pheragu@codeaurora.org> <6799952fbd3639c764c112bde961b5e00270a52d.camel@perches.com> <6ed46f85a7577e1d4a48e81f67fd7581@codeaurora.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.28.1-2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2018-07-13 at 16:28 -0700, pheragu@codeaurora.org wrote: > On 2018-07-13 14:46, Joe Perches wrote: > > On Fri, 2018-07-13 at 14:40 -0700, Prakruthi Deepak Heragu wrote: > > > Commit text is almost always necessary to explain why a change is > > > needed. > > > > This bit seems sensible, but perhaps it should just count the > > number of lines after the end of email headers and before any > > Signed-off-by:/Signature line > > > > While committing the changes, one can just write the subject and not > write > the commit text at all. So, if we just count the lines between email > headers > and signed-off, we still do count lines which form the subject, but the > commit text is still absent. Also, subject can be longer than one line. > So, > just counting lines doesn't really guarantee the presence of commit > text. Not true. Look at $in_header_lines and $in_commit_log. > > > Also, warn on commit text lines longer than 75 characters. The commit > > > text > > > are indented and may wrap on a terminal if they are longer than 75 > > > characters. > > > > This is already exists via > > > > # Check for line lengths > 75 in commit log, warn once > > if ($in_commit_log && !$commit_log_long_line && > > length($line) > 75 && > > > > True, but this patch points out every line of the commit text that is > exceeding the limit. Which is bad because things like dump_stack() are added in commit logs and those are already allowed to be > 75 chars. Anyway, something like this probably works. Please test. --- scripts/checkpatch.pl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index b5c875d7132b..8b5f3dae31c9 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2240,6 +2240,7 @@ sub process { my $in_header_lines = $file ? 0 : 1; my $in_commit_log = 0; #Scanning lines before patch my $has_commit_log = 0; #Encountered lines before patch + my $commit_log_lines = 0; #Number of commit log lines my $commit_log_possible_stack_dump = 0; my $commit_log_long_line = 0; my $commit_log_has_diff = 0; @@ -2497,6 +2498,18 @@ sub process { $cnt_lines++ if ($realcnt != 0); +# Verify the existence of a commit log if appropriate +# 2 is used because a $signature is counted in $commit_log_lines + if ($in_commit_log) { + if ($line !~ /^\s*$/) { + $commit_log_lines++; #could be a $signature + } + } else if ($has_commit_log && $commit_log_lines < 2) { + WARN("COMMIT_MESSAGE", + "Missing commit description - Add an appropriate one\n"); + $commit_log_lines = 2; #warn only once + } + # Check if the commit log has what seems like a diff which can confuse patch if ($in_commit_log && !$commit_log_has_diff && (($line =~ m@^\s+diff\b.*a/[\w/]+@ &&