From nobody Thu May 2 22:01:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1604643384; cv=none; d=zohomail.com; s=zohoarc; b=b1dxdbHVwRL+c+qkIX04i1APwL/Z+rSAco48BNgc7wxICyUxciAd3GLuJv42cUIRnEISSsx1B78Jqs+CCrod6qae+hVEs3K8EaccTi6VJTvRzFmy+LK2rbJc1+KUM0wloWGLcZn8E0PUknjV5yWjTAz/mk8pa3exn6Y5H/ldzW0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604643384; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=cX26OKhdR079Y6mCHiXLhcblrdFN+jUc1feAK+Os18o=; b=Sse+vrIaQHfJhAWSzguwQgZVlATRwvl8erczqAu6h8TV3BgxZ0CYkLP88pxKwNRoRcteTtTH7IZLiY2w2/1Zb6D2Ioe9F0zPX/K98Cw/ccu0+PWTNrlF6v7WvxOoHeAsdVTa5kuFFvFO1e4FqKPNMxI3MNthIRbkM/5MV2k/KdY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604643384208899.7470849479014; Thu, 5 Nov 2020 22:16:24 -0800 (PST) Received: from localhost ([::1]:58678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kav2t-000461-0e for importer@patchew.org; Fri, 06 Nov 2020 01:16:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53014) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kav2C-0003Yz-Sh; Fri, 06 Nov 2020 01:15:40 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:2078) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kav2A-0008Gz-H0; Fri, 06 Nov 2020 01:15:40 -0500 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4CS99Q2VS0zhdDS; Fri, 6 Nov 2020 14:15:22 +0800 (CST) Received: from huawei.com (10.175.104.175) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.487.0; Fri, 6 Nov 2020 14:15:18 +0800 From: Gan Qixin To: , Subject: [PATCH] scripts/checkpatch.pl: Modify the line length limit of the code Date: Thu, 5 Nov 2020 23:42:08 +0800 Message-ID: <20201105154208.12442-1-ganqixin@huawei.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.104.175] X-CFilter-Loop: Reflected Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=45.249.212.32; envelope-from=ganqixin@huawei.com; helo=szxga06-in.huawei.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/06 01:15:26 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_12_24=1.049, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, berrange@redhat.com, zhang.zhanghailiang@huawei.com, mst@redhat.com, ganqixin@huawei.com, pbonzini@redhat.com, kuhn.chenqun@huawei.com, philmd@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Modify the rule that limit the length of lines according to the following i= deas: --add a variable max_line_length to indicate the limit of line length and s= et it to 100 by default --when the line length exceeds max_line_length, output warning information = instead of error --if/while/etc brace do not go on next line whether the line length exceeds= max_line_length or not Signed-off-by: Gan Qixin Reviewed-by: Peter Maydell --- scripts/checkpatch.pl | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 88c858f67c..84a72d47ad 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -35,6 +35,7 @@ my $summary_file =3D 0; my $root; my %debug; my $help =3D 0; +my $max_line_length =3D 100; =20 sub help { my ($exitcode) =3D @_; @@ -1628,17 +1629,13 @@ sub process { # check we are in a valid source file if not then ignore this hunk next if ($realfile !~ /$SrcFile/); =20 -#90 column limit; exempt URLs, if no other words on line +#$max_line_length column limit; exempt URLs, if no other words on line if ($line =3D~ /^\+/ && !($line =3D~ /^\+\s*"[^"]*"\s*(?:\s*|,|\)\s*;)\s*$/) && !($rawline =3D~ /^[^[:alnum:]]*https?:\S*$/) && - $length > 80) + $length > $max_line_length) { - if ($length > 90) { - ERROR("line over 90 characters\n" . $herecurr); - } else { - WARN("line over 80 characters\n" . $herecurr); - } + WARN("line over $max_line_length characters\n" . $herecurr); } =20 # check for spaces before a quoted newline @@ -1831,13 +1828,8 @@ sub process { #print "realcnt<$realcnt> ctx_cnt<$ctx_cnt>\n"; #print "pre<$pre_ctx>\nline<$line>\nctx<$ctx>\nnext<$lines[$ctx_ln - 1]= >\n"; =20 - # The length of the "previous line" is checked against 80 because it - # includes the + at the beginning of the line (if the actual line has - # 79 or 80 characters, it is no longer possible to add a space and an - # opening brace there) if ($#ctx =3D=3D 0 && $ctx !~ /{\s*/ && - defined($lines[$ctx_ln - 1]) && $lines[$ctx_ln - 1] =3D~ /^\+\s*\{/= && - defined($lines[$ctx_ln - 2]) && length($lines[$ctx_ln - 2]) < 80) { + defined($lines[$ctx_ln - 1]) && $lines[$ctx_ln - 1] =3D~ /^\+\s*\{/= ) { ERROR("that open brace { should be on the previous line\n" . "$here\n$ctx\n$rawlines[$ctx_ln - 1]\n"); } --=20 2.23.0