From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19703C64E7C for ; Wed, 2 Dec 2020 20:11:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BB4D122244 for ; Wed, 2 Dec 2020 20:11:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730608AbgLBULQ (ORCPT ); Wed, 2 Dec 2020 15:11:16 -0500 Received: from smtprelay0248.hostedemail.com ([216.40.44.248]:40246 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729186AbgLBULQ (ORCPT ); Wed, 2 Dec 2020 15:11:16 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay07.hostedemail.com (Postfix) with ESMTP id D1CEE181D337B; Wed, 2 Dec 2020 20:10:34 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: teeth55_5c01c8d273b5 X-Filterd-Recvd-Size: 3695 Received: from [192.168.1.142] (unknown [172.58.19.39]) (Authenticated sender: joe@perches.com) by omf19.hostedemail.com (Postfix) with ESMTPA; Wed, 2 Dec 2020 20:10:33 +0000 (UTC) Message-ID: Subject: Re: [PATCH] checkpatch: add warning for lines starting with a '#' in commit log From: Joe Perches To: Dwaipayan Ray Cc: linux-kernel-mentees@lists.linuxfoundation.org, linux-kernel , Lukas Bulwahn , Peilin Ye Date: Wed, 02 Dec 2020 12:10:29 -0800 In-Reply-To: References: <20201202101448.8494-1-dwaipayanray1@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2020-12-03 at 01:30 +0530, Dwaipayan Ray wrote: > On Wed, Dec 2, 2020 at 3:45 PM Dwaipayan Ray wrote: > > > > Commit log lines starting with a '#' can be dropped by git if > > the corresponding commit message is reworded by a maintainer. > > This minor error can be easily avoided if checkpatch warns > > for the same. > > > > Add a new check which emits a warning on finding lines starting > > with a '#'. Also add a quick fix by adding a tab in front of > > such lines. > > > > Suggested-by: Peilin Ye > > Tested-by: Peilin Ye > > Signed-off-by: Dwaipayan Ray > > --- > >  scripts/checkpatch.pl | 9 +++++++++ > >  1 file changed, 9 insertions(+) > > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > > index e8c1ed0b1fad..a12edcf4f63a 100755 > > --- a/scripts/checkpatch.pl > > +++ b/scripts/checkpatch.pl > > @@ -2966,6 +2966,15 @@ sub process { > >                         $commit_log_possible_stack_dump = 0; > >                 } > > > > +# Check for lines starting with a # > > + if ($in_commit_log && $line =~ /^#/) { > > + if (WARN("POSSIBLE_IGNORED_LINE", > > + "Commit log lines starting with a '#' might be dropped by git.\n" . $herecurr) > > + && $fix) { > > + $fixed[$fixlinenr] =~ s/^#/\t#/; > > + } > > + } > > + > >  # Check for git id commit length and improperly formed commit descriptions > >                 if ($in_commit_log && !$commit_log_possible_stack_dump && > >                     $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink|base-commit):/i && > > -- > > 2.27.0 > > > Hi, > This patch may seem trivial but I wanted to send it to you for review > nevertheless. > > Peilin had earlier faced this problem in one of his patches which was > mainlined. There were some '#define' lines in the commit log. Due to > some reason the Maintainer had to reword the commit message, and > ultimately those '#define' lines were lost in the tree that was merged. > > I am not sure if it would be exactly helpful for regular committers but for > new contributers it might be nice to avoid such a mistake. Do you think > it deserves inclusion in checkpatch? Even regular committers face this. Please fix the && $fix so that the && is at EOL and change the 'might be dropped' to 'will be dropped by git as a comment' and remove the period. "POSSIBLE_IGNORED_LINE" could be something like "COMMIT_COMMENT_SYMBOL".