From nobody Mon Feb 9 10:25:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1536828943702262.81518090451425; Thu, 13 Sep 2018 01:55:43 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 96DCD285B4; Thu, 13 Sep 2018 08:55:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D150D5D9C9; Thu, 13 Sep 2018 08:55:39 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 16327181A12E; Thu, 13 Sep 2018 08:55:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8D8tZ3S002782 for ; Thu, 13 Sep 2018 04:55:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id 771BF60BEC; Thu, 13 Sep 2018 08:55:35 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 66F9760BE5 for ; Thu, 13 Sep 2018 08:55:33 +0000 (UTC) Received: from m97134.mail.qiye.163.com (m97134.mail.qiye.163.com [220.181.97.134]) by mx1.redhat.com (Postfix) with ESMTP id 15B9F811A4 for ; Thu, 13 Sep 2018 08:55:31 +0000 (UTC) Received: from localhost.localdomain (unknown [58.56.27.130]) by smtp5 (Coremail) with SMTP id huCowACHxWL+JZpbTfvyAQ--.224S3; Thu, 13 Sep 2018 16:55:28 +0800 (CST) From: Shi Lei To: libvir-list@redhat.com Date: Thu, 13 Sep 2018 16:55:19 +0800 Message-Id: <20180913085524.3520-2-shi_lei@massclouds.com> In-Reply-To: <20180913085524.3520-1-shi_lei@massclouds.com> References: <20180913085524.3520-1-shi_lei@massclouds.com> X-CM-TRANSID: huCowACHxWL+JZpbTfvyAQ--.224S3 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUU8529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjTRNHUDUUUUU X-Originating-IP: [58.56.27.130] X-CM-SenderInfo: pvklsz1hl6ztxvvfz0xxgvhudrp/1tbiAwDAT1illUjkzwAAsH X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 212 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 13 Sep 2018 08:55:32 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 13 Sep 2018 08:55:32 +0000 (UTC) for IP:'220.181.97.134' DOMAIN:'m97134.mail.qiye.163.com' HELO:'m97134.mail.qiye.163.com' FROM:'shi_lei@massclouds.com' RCPT:'' X-RedHat-Spam-Score: -0.01 (RCVD_IN_DNSWL_NONE) 220.181.97.134 m97134.mail.qiye.163.com 220.181.97.134 m97134.mail.qiye.163.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 1/6] build-aux:check-spacing.pl: Introduce syntax-check rule for incorrect indentation and blank first line in function body X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 13 Sep 2018 08:55:41 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This patch add syntax-check rule for incorrect indentation and blank first line in function body by changing check-spacing.pl. For efficiency, it only checks the first line of function body. But it's enough for most cases. Signed-off-by: Shi Lei --- build-aux/check-spacing.pl | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/build-aux/check-spacing.pl b/build-aux/check-spacing.pl index ca8b434..da9a58b 100755 --- a/build-aux/check-spacing.pl +++ b/build-aux/check-spacing.pl @@ -31,6 +31,7 @@ foreach my $file (@ARGV) { my $cb_linenum =3D 0; my $cb_code =3D ""; my $cb_scolon =3D 0; + my $fn_linenum =3D 0; =20 open FILE, $file; =20 @@ -50,6 +51,27 @@ foreach my $file (@ARGV) { =20 next if $data =3D~ /^#/; =20 + # Detect start of function block + if ($data =3D~ /^{$/) { + $fn_linenum =3D $.; + } + + # Handle first line of function block + if ($fn_linenum && $fn_linenum !=3D $.) { + if ($data =3D~ /^\s*$/) { + print "Blank line before content in function body:\n"; + print "$file:$.:\n$line"; + $ret =3D 1; + } elsif ($data !~ /^[ ]{4}\S/) { + unless ($data =3D~ /^[ ]\w+:$/ || $data =3D~ /^}/) { + print "Incorrect indentation in function body:\n"; + print "$file:$.:\n$line"; + $ret =3D 1; + } + } + $fn_linenum =3D 0; + } + # Kill contents of multi-line comments # and detect end of multi-line comments if ($incomment) { --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list