Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2637594imm; Mon, 16 Jul 2018 11:22:07 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcYYY1rCDM+mmNZUL1GVP7qAPpHn4YQJaH4guLBpKwFxA3THFqjyGuvgHz7nPSM3HjtX3um X-Received: by 2002:a17:902:9345:: with SMTP id g5-v6mr17635196plp.10.1531765327100; Mon, 16 Jul 2018 11:22:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531765327; cv=none; d=google.com; s=arc-20160816; b=xF1BAuwq37Ak7rHqaF+bwvhBQkAzPmOtXCLg233MHCFx45nhx26UuiibTz26cC6rLI TvI8v3etL0vdOI8kw8M3z1QhLIga6UDbmeaAu34cC+AcWg9gUpIOhLqWuZiEOxbAvDYs G7Q4iSuABjzdKc+2nXR3AHfx11DbxfgXvo6wGolbqZ7+lvixC6RB0gljEFc7mo31OXkf nYN4iPYx9n6Ed8fKkwXbPPyZbHOPDCXU4s724O3zxMz4akn12P3+Q54+uau6yQl6nHwH oGruzURwiQCn7UaEy8df76hGFHIrMG+Ss81lMjeGFjg/O7uDUqEcbrNYzBUu91Ix5EHc ZnDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=z25wVOhpgcgpelmoxEVfpMCX0UqTdZg9G8P5eQziOpk=; b=FR0UnL9JegZjHCNgZTyXaT0cl0oFtNte6vry+t78KwDms/icQVAgaSR4EIZ7mvYYPf m0qlrMHd0KMRQvKdJiS33bPGAfnR1ttus0/ZXrOuQUszUINhVeKRpAlA6WqVmyShbXFU 09k9nMLf4RFZ8IGtYobN+VPbAskJ7dHhF0/xECnipUJxnVyvy6PYgNUXW/YYFFPTqmoq aW5NI5tzUQ3kGN3Ij6jOmjni4mIrXTILzXIved/CUJ0uq+VEszqkZlNSf+k0mArqi/jF RWcLrKFOpqD3kTD3Di/3tG3UAGt4FUBgAnX3kJ3LqXuHDLLKMiZSk7/eaLHLRNQu+AHB tSrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=YQLBD8rh; dkim=pass header.i=@codeaurora.org header.s=default header.b=YyvdlORh; 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 w37-v6si30248464pgl.514.2018.07.16.11.21.52; Mon, 16 Jul 2018 11:22:07 -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; dkim=pass header.i=@codeaurora.org header.s=default header.b=YQLBD8rh; dkim=pass header.i=@codeaurora.org header.s=default header.b=YyvdlORh; 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 S1729595AbeGPStI (ORCPT + 99 others); Mon, 16 Jul 2018 14:49:08 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:33264 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727479AbeGPStI (ORCPT ); Mon, 16 Jul 2018 14:49:08 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 3681160116; Mon, 16 Jul 2018 18:20:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1531765232; bh=9teOpVWxnm593NjaRxTRqMEOUkCRFBTmu8z9T4gmXUo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=YQLBD8rhM+RliTzY4LSUqf9CquIa/SRgFBWG9ReeLBkqoQQ8ZzDeZNA9RaVV7/aGb 42UoTf+sP/q7owzmHa7tlZ7pduoAY+nWBIId/nG1c2v6EHTlfFz5Kz75CFXvciTR6s 9qbY8JHgocwppBMPXcgXMS+p+YeW6jtuHbPFU6tE= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 2C5FF60116; Mon, 16 Jul 2018 18:20:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1531765216; bh=9teOpVWxnm593NjaRxTRqMEOUkCRFBTmu8z9T4gmXUo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=YyvdlORh0nQNwwO2tCtXZa1nqykrYVI2DKo9+zUcvcdD7V0yXUPkCaByOV+yR7FbC JFJDXbfktOgy+qi4WXenlNpULIF2R3ETgAClPd7MggwNRcC7ZvI5kiKMnbGzkTIuAL ZACf6ZnnL9vczrOgHMTi9suBbX4bKniUoRkSJyO4= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 16 Jul 2018 11:20:14 -0700 From: pheragu@codeaurora.org To: Joe Perches Cc: Andrew Morton , Greg KH , apw@canonical.com, linux-kernel@vger.kernel.org, tsoni@codeaurora.org, bryanh@codeaurora.org, ckadabi@codeaurora.org, David Keitel Subject: Re: [PATCH] checkpatch: Require commit text and warn on long commit text lines In-Reply-To: <50a05aaf44e5f86cbf687863dadaa26b45debe2d.camel@perches.com> References: <1531518027-13318-1-git-send-email-pheragu@codeaurora.org> <6799952fbd3639c764c112bde961b5e00270a52d.camel@perches.com> <6ed46f85a7577e1d4a48e81f67fd7581@codeaurora.org> <50a05aaf44e5f86cbf687863dadaa26b45debe2d.camel@perches.com> Message-ID: <59a1b82fd854c9bf8a530bb053b718dc@codeaurora.org> X-Sender: pheragu@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-07-13 17:08, Joe Perches wrote: > 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/]+@ && I checked all the cases that I mentioned before. The change you suggested works for every case. Would you take care of merging this fix?