Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp2952133img; Mon, 25 Mar 2019 00:10:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqyFTW09r5+LSAD2/2kVU168X2bKOUzON+y5Tm0+vfK7rTPxzYLvw1wMt1pjgYBPjKj2ZUze X-Received: by 2002:a63:5515:: with SMTP id j21mr22099156pgb.244.1553497802236; Mon, 25 Mar 2019 00:10:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553497802; cv=none; d=google.com; s=arc-20160816; b=YQxWBe6XnC3Uzf0VTxecAJZReB0Q4pVpCwP8RX1FrQOewA9fO7x/VaqAban8m4Fa6c 8uzoP3DThV08SwFzqwPuHqTff9qShP2cJtYCFhRZgnDKySj6ha0HhKxQUUZKwGNB/A96 8krA/3ViG/eAcRIP3TnjhTSwq+CWjf2yWuVQnsqKt577jDma4gZhcNtOAKinhxoDS5Hy sIBEzG6qetMmiCruHNow40sMREjC/O4gFALQNq8TkGo+G5mJ8ahNI27EuEAIFHfaVNBD V21V7fY47TWfJSEyHTqSeX9Zz60PTt2Smv+7N7Cs+H740dSj/LWHCE59cklbojfmv70E bkkQ== 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:in-reply-to :mime-version:user-agent:date:message-id:references:subject:to:from; bh=vqNk+l1G3lCS2U5VH1xYAkSIS3z12pBUoKfLmRw9F/0=; b=PfKtmrCuUClB52g7XaN00+c/naTyZGz+PUGqvrMg4bQa1FjKPBQSe/NUaYHYg6xOqk ry11C1qAPAAPscVvnrkki0WjkLBfvc/j4K5JsWTMC+/cV9zb1TgBqTTg87c/ykJG6id4 dEgwosW/Y+horwlLL6g9OxWW8ooWKkiCHSRk24VbNK7CBC6OrfG1OGMaLbExAU5jcAt8 BlyiG1NuxH+FADEVe9YYBUZjqmc7DZSyCdA+ftXBtpS/4gVeYu04t7WC5ckmkYmALuEc C4+lc2wmamX/HIiMuXYJcCwVgTsxgmTn40Ns/5iampOjHvKqmwLvlbu4SjLKDkGGHbKM R8DQ== 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 q12si14247323pli.428.2019.03.25.00.09.47; Mon, 25 Mar 2019 00:10:02 -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 S1729792AbfCYHH4 (ORCPT + 99 others); Mon, 25 Mar 2019 03:07:56 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:58053 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729230AbfCYHH4 (ORCPT ); Mon, 25 Mar 2019 03:07:56 -0400 X-Originating-IP: 79.86.19.127 Received: from [192.168.0.11] (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 0DADF1C0009; Mon, 25 Mar 2019 07:07:52 +0000 (UTC) From: Alex Ghiti To: Andy Whitcroft , Joe Perches , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] scripts: checkpatch: Check multiple blank lines when deleting code References: <20190306195324.11634-1-alex@ghiti.fr> Message-ID: <43f07161-8405-c934-ee84-3eb1f99c0b9b@ghiti.fr> Date: Mon, 25 Mar 2019 03:07:52 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/17/19 11:49 AM, Alex Ghiti wrote: > On 3/6/19 2:53 PM, Alexandre Ghiti wrote: >> By matching only current line starting with '+', we miss the case >> when deleting code makes consecutive blank lines appear: this patch >> then makes it possible to detect this case by also matching current >> line starting with ' ', which is an already existing blank line. >> >> Signed-off-by: Alexandre Ghiti >> --- >> >> Changes in v3 as suggested by Joe Perches: >>     - Do not try to fix this case >>     - Make this test separate from the insertion one so that warning >>       is more explicit >> >> Changes in v2: >>     - Fix the --fix option >> >>   scripts/checkpatch.pl | 12 +++++++++++- >>   1 file changed, 11 insertions(+), 1 deletion(-) >> >> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl >> index b737ca9d7204..c0728cff292f 100755 >> --- a/scripts/checkpatch.pl >> +++ b/scripts/checkpatch.pl >> @@ -3296,7 +3296,7 @@ sub process { >>               } >>           } >>   -# check for multiple consecutive blank lines >> +# check for multiple consecutive blank lines caused by blank line >> insertion >>           if ($prevline =~ /^[\+ ]\s*$/ && >>               $line =~ /^\+\s*$/ && >>               $last_blank_line != ($linenr - 1)) { >> @@ -3309,6 +3309,16 @@ sub process { >>               $last_blank_line = $linenr; >>           } >>   +# check for multiple consecutive blank lines caused by code deletion >> +        if ($prevline =~ /^[\+ ]\s*$/ && >> +            $line =~ /^ \s*$/ && >> +            $last_blank_line != ($linenr - 1)) { >> +            CHK("LINE_SPACING", >> +                "Avoid deleting lines that create consecutive blank >> lines\n" . $hereprev); >> + >> +            $last_blank_line = $linenr; >> +        } >> + >>   # check for missing blank lines after declarations >>           if ($sline =~ /^\+\s+\S/ &&            #Not at char 1 >>               # actual declarations > > > Hi Joe, > > Can I do something more this patch ? > > Thanks, > > Alex > Hi, Sorry for insisting, but do you consider this patch for inclusion ? Thanks, Alex