Received: by 2002:ac0:950e:0:0:0:0:0 with SMTP id f14csp1267151imc; Sun, 17 Mar 2019 08:50:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqw7TotCQpx17QTkhuDvYwBePtZc9FKmV4cufklrMvRclr4t5aUlcnDK+hrKimwXzeb0Gock X-Received: by 2002:a17:902:8bc6:: with SMTP id r6mr15340587plo.235.1552837845442; Sun, 17 Mar 2019 08:50:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552837845; cv=none; d=google.com; s=arc-20160816; b=H7bJspxbTiy+1PZjsISDfnJA4z/T/BSPqW2tOEqR0v1F4vE4oJXAOlxa2vGNztfcz3 cM9gJVwyhyPz6nBDQoVbXL3/UK0YokDohEwvdAX/hjqjjmN54FIcliRzb6U1vMdUHDfK VlGpDbBQG/3ghnJ/oUveqoyVqZp1z6zrrcNEENNsuRKiG7PIGBDhXF+eG61kP76dv5rU sdspU33UPWgu4WmgkdX+RAJwo0AD5JwJRRN78W16vACilIXALIvZZ3cO+//p/8J6o1eO leYE9NxKoikxfKPcY65UfwmpSUQQKGUwaql6hFPw6UJ9f1iLg1X4hf7Ew0hOz4aGCvSp 9vRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject; bh=7/vMW8OTPF9dPtZC3c5dHn4LHGVYMHIuS1bFX265KV8=; b=ltBd31pw1DzbrogRgpcBzOn0+nQwpWmM0hvAD49UAaVtwIaWZ51RxtvHsEpqYsjkp1 2gYHN6eq6q/nhD4TadRCjKXLWOwParLIH86szzFasHrP41qj8AxZdgWNfu8Vv04aHQsM MhnajY6nOAXuAPDred8tQJ2bAqGen6zkNx91DkroHAKthvFiWqF6q+JY7CtwsgfpvNcY XOSxxa+VMmePoP8R/m9qtDdQZpVTVTawX4qAzSZ7IRHfaaO86D1BKgYHu7bMnPulp1+U Fv50Rysjrwgn45YyLNvRlt1T5ZHU1o4zwmb5yVtlftPZ4j4CC9rCVb7LBP5xxXnpPnbF sSeg== 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 v5si6583161pgs.334.2019.03.17.08.50.30; Sun, 17 Mar 2019 08:50:45 -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 S1727504AbfCQPt1 (ORCPT + 99 others); Sun, 17 Mar 2019 11:49:27 -0400 Received: from relay11.mail.gandi.net ([217.70.178.231]:35555 "EHLO relay11.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726812AbfCQPt1 (ORCPT ); Sun, 17 Mar 2019 11:49:27 -0400 Received: from [192.168.0.11] (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay11.mail.gandi.net (Postfix) with ESMTPSA id AADF3100003; Sun, 17 Mar 2019 15:49:24 +0000 (UTC) Subject: Re: [PATCH v3] scripts: checkpatch: Check multiple blank lines when deleting code To: Andy Whitcroft , Joe Perches , linux-kernel@vger.kernel.org References: <20190306195324.11634-1-alex@ghiti.fr> From: Alex Ghiti Message-ID: Date: Sun, 17 Mar 2019 11:49:24 -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: <20190306195324.11634-1-alex@ghiti.fr> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Content-Language: sv-FI Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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