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=-3.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no 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 A01FDC4361B for ; Thu, 10 Dec 2020 18:14:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4FD8B23D57 for ; Thu, 10 Dec 2020 18:14:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404112AbgLJSOy (ORCPT ); Thu, 10 Dec 2020 13:14:54 -0500 Received: from smtprelay0010.hostedemail.com ([216.40.44.10]:56408 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2403993AbgLJSO1 (ORCPT ); Thu, 10 Dec 2020 13:14:27 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay05.hostedemail.com (Postfix) with ESMTP id BEBA818029146; Thu, 10 Dec 2020 18:13:43 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: arm83_08169e1273fa X-Filterd-Recvd-Size: 1973 Received: from XPS-9350.home (unknown [47.151.137.21]) (Authenticated sender: joe@perches.com) by omf14.hostedemail.com (Postfix) with ESMTPA; Thu, 10 Dec 2020 18:13:42 +0000 (UTC) Message-ID: Subject: Re: [PATCH] checkpatch: Fix "Missing a blank line after declarations" test on patches From: Joe Perches To: Christophe JAILLET , apw@canonical.com, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Date: Thu, 10 Dec 2020 10:13:40 -0800 In-Reply-To: <20201210175235.65657-1-christophe.jaillet@wanadoo.fr> References: <20201210175235.65657-1-christophe.jaillet@wanadoo.fr> 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-10 at 18:52 +0100, Christophe JAILLET wrote: > "Missing a blank line after declarations" is not triggered on patches. That's not true. It does work on any patch that does a new function addition. There are some patch context complications here when lines are added and removed such that '+' add, '-' delete, and ' ' context testing isn't always obvious. So, the code was intentionally limited to just new functions. If there are simple ways to avoid false positives, great, but I believe it's not trivial. > Tweak the regex to match such cases. Please send multiple patch examples of different forms where it does not work. > This patch is mostly a PoC. I don't know enough about checkpatch.pl to be > sure that the fix is the right thing to do. > At least, it works for me :) Always a starting point... > > The [\+ ] is taken from the test just above. > > I also wonder if there is a missing ^ in the last test: >   (($prevline =~ /[\+ ](\s+)\S/) && $sline =~ /^[\+ ]$1\S/)) >                   ^ >                   |___ here