From: Markus Armbruster <armbru@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, thuth@redhat.com, famz@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/3] checkpatch: tweak the files in which TABs are checked
Date: Wed, 10 Aug 2016 08:46:07 +0200 [thread overview]
Message-ID: <878tw55dg0.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <1470757664-25161-2-git-send-email-pbonzini@redhat.com> (Paolo Bonzini's message of "Tue, 9 Aug 2016 17:47:42 +0200")
Paolo Bonzini <pbonzini@redhat.com> writes:
> Include Python and shell scripts, and make an exception for Perl
> scripts we imported from Linux or elsewhere.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> scripts/checkpatch.pl | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index b7cb4ab..7ccf6a8 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1351,8 +1351,10 @@ sub process {
> WARN("adding a line without newline at end of file\n" . $herecurr);
> }
>
> -# check we are in a valid source file C or perl if not then ignore this hunk
> - next if ($realfile !~ /\.(h|c|cpp|pl)$/);
> +# check we are in a valid source file; if not then tabs are allowed.
> +# make an exception from some scripts imported from other projects.
> + next if ($realfile !~ /\.(h|c|cpp|pl|py|sh)$/);
> + next if ($realfile =~ /(checkpatch|get_maintainer|texi2pod)\.pl$/);
>
> # in QEMU, no tabs are allowed
> if ($rawline =~ /^\+.*\t/) {
I'm afraid "if not then tabs are allowed" is confusing. We're obviously
skipping more than just the tabs check: RCS/CVS revision markers, and a
whole bunch of C style checks. Makes sense, we don't want to do these
checks for imported files. "if not then tabs are allowed" starts to
make some sense only once you've stared at the next "next if ..." line
for a while. Let's avoid that. Minimal change:
# check we are in a valid source file; if not then ignore this hunk
# make an exception from some scripts imported from other projects.
Radim's "[PATCH] checkpatch: ignore automatically imported Linux
headers" adds a similar exception for other imported files in a
different place:
@@ -1312,6 +1312,9 @@ sub process {
# ignore non-hunk lines and lines being removed
next if (!$hunk_line || $line =~ /^-/);
+# ignore files that are being periodically imported from Linux
+ next if ($realfile =~ /^(linux-headers|include\/standard-headers)\//);
+
#trailing whitespace
if ($line =~ /^\+.*\015/) {
my $herevet = "$here\n" . cat_vet($rawline) . "\n";
Should both exceptions be in the same place?
next prev parent reply other threads:[~2016-08-10 6:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-09 15:47 [Qemu-devel] [PATCH 0/3] checkpatch tweaks Paolo Bonzini
2016-08-09 15:47 ` [Qemu-devel] [PATCH 1/3] checkpatch: tweak the files in which TABs are checked Paolo Bonzini
2016-08-10 2:06 ` Fam Zheng
2016-08-10 6:46 ` Markus Armbruster [this message]
2016-08-10 7:32 ` Cornelia Huck
2016-08-09 15:47 ` [Qemu-devel] [PATCH 2/3] checkpatch: bump most warnings to errors Paolo Bonzini
2016-08-10 6:53 ` Markus Armbruster
2016-08-10 7:08 ` Paolo Bonzini
2016-08-10 7:48 ` Markus Armbruster
2016-08-10 7:58 ` Paolo Bonzini
2016-08-10 7:48 ` Cornelia Huck
2016-08-10 7:46 ` Cornelia Huck
2016-08-10 7:58 ` Paolo Bonzini
2016-08-09 15:47 ` [Qemu-devel] [PATCH 3/3] checkpatch: default to success if only warnings Paolo Bonzini
2016-08-10 2:10 ` [Qemu-devel] [PATCH 0/3] checkpatch tweaks Fam Zheng
2016-08-10 7:15 ` Christian Borntraeger
2016-08-10 7:52 ` Cornelia Huck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878tw55dg0.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=famz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.