From: "Alex Bennée" <alex.bennee@linaro.org>
To: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Cc: "Daniel P. Berrangé " <berrange@redhat.com>,
qemu-devel@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>
Subject: Re: [PATCH v2] scripts/checkpatch.pl: check for placeholders in cover letter patches
Date: Tue, 30 Jan 2024 15:11:00 +0000 [thread overview]
Message-ID: <875xzaonzv.fsf@draig.linaro.org> (raw)
In-Reply-To: <82lcl.1qg7az61g8ip@linaro.org> (Manos Pitsidianakis's message of "Tue, 30 Jan 2024 12:26:54 +0200")
Manos Pitsidianakis <manos.pitsidianakis@linaro.org> writes:
> On Tue, 30 Jan 2024 12:15, "Daniel P. Berrangé" <berrange@redhat.com> wrote:
>>On Tue, Jan 30, 2024 at 12:11:07PM +0200, Manos Pitsidianakis wrote:
>>> Check if a file argument is a cover letter patch produced by
>>> git-format-patch --cover-letter; It is initialized with subject suffix "
>>> *** SUBJECT HERE ***" and body prefix " *** BLURB HERE ***". If they
>>> exist, warn the user.
>>> Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
>>> ---
>>> Range-diff against v1:
>>> 1: 64b7ec2287 ! 1: 9bf816eb4c scripts/checkpatch.pl: check for placeholders in cover letter patches
>>> @@ scripts/checkpatch.pl: sub process {
>>> +# --cover-letter; It is initialized with subject suffix
>>> +# " *** SUBJECT HERE ***" and body prefix " *** BLURB HERE ***"
>>> + if ($in_header_lines &&
>>> -+ $rawline =~ /^Subject:.+[*]{3} SUBJECT HERE [*]{3}\s*$/) {
>>> -+ WARN("Patch appears to be a cover letter with uninitialized subject" .
>>> -+ " '*** SUBJECT HERE ***'\n$hereline\n");
>>> ++ $rawline =~ /^Subject:.+[*]{3} SUBJECT HERE [*]{3}\s*$/) {
>>> ++ WARN("Patch appears to be a cover letter with " .
>>> ++ "uninitialized subject '*** SUBJECT HERE ***'\n$hereline\n");
>>> + }
>>> +
>>> + if ($rawline =~ /^[*]{3} BLURB HERE [*]{3}\s*$/) {
>>> -+ WARN("Patch appears to be a cover letter with leftover placeholder " .
>>> -+ "text '*** BLURB HERE ***'\n$hereline\n");
>>> ++ WARN("Patch appears to be a cover letter with " .
>>> ++ "leftover placeholder text '*** BLURB HERE ***'\n$hereline\n");
>>> + }
>>> +
>>> if ($in_commit_log && $non_utf8_charset && $realfile =~ /^$/ &&
>>> scripts/checkpatch.pl | 14 ++++++++++++++
>>> 1 file changed, 14 insertions(+)
>>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>>> index 7026895074..9a8d49f1d8 100755
>>> --- a/scripts/checkpatch.pl
>>> +++ b/scripts/checkpatch.pl
>>> @@ -1650,6 +1650,20 @@ sub process {
>>> $non_utf8_charset = 1;
>>> }
>>> +# Check if this is a cover letter patch produced by
>>> git-format-patch
>>> +# --cover-letter; It is initialized with subject suffix
>>> +# " *** SUBJECT HERE ***" and body prefix " *** BLURB HERE ***"
>>> + if ($in_header_lines &&
>>> + $rawline =~ /^Subject:.+[*]{3} SUBJECT HERE [*]{3}\s*$/) {
>>
>>This continuation line is now hugely over-indented - it should
>>be aligned just after the '('
>
> It is not, it just uses tabs. Like line 2693 in current master:
>
> https://gitlab.com/qemu-project/qemu/-/blob/11be70677c70fdccd452a3233653949b79e97908/scripts/checkpatch.pl#L2693
>
> I will quote the **QEMU Coding Style** again on whitespace:
>
>> Whitespace
>> Of course, the most important aspect in any coding style is
>> whitespace. Crusty old coders who have trouble spotting the glasses
>> on their noses can tell the difference between a tab and eight
>> spaces from a distance of approximately fifteen parsecs. Many a
>> flamewar has been fought and lost on this issue.
>
>> QEMU indents are four spaces. Tabs are never used, except in
>> Makefiles where they have been irreversibly coded into the syntax.
>> Spaces of course are superior to tabs because:
>> You have just one way to specify whitespace, not two. Ambiguity
>> breeds mistakes.
>> The confusion surrounding ‘use tabs to indent, spaces to
>> justify’ is gone.
>> Tab indents push your code to the right, making your screen
>> seriously unbalanced.
>> Tabs will be rendered incorrectly on editors who are
>> misconfigured not to use tab stops of eight positions.
>> Tabs are rendered badly in patches, causing off-by-one errors in
>> almost every line.
>> It is the QEMU coding style.
>
> I think it's better if we leave this discussion here, and accept v1
> which is consistent with the coding style, or this one which is
> consistent with the inconsistency of the tabs and spaces mix of the
> checkpatch.pl source code as a compromise, if it is deemed important.
I suspect the problem is that checkpatch.pl is an import from the Linux
source tree which has since had syncs with its upstream as well as a
slew of QEMU specific patches. If we don't care about tracking upstream
anymore we could bite the bullet and fix indentation going forward.
Of course arguably we should replace it with a python script and reduce
our dependence on perl. I'm sure someone had a go at that once but it
might have only been a partial undertaking.
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2024-01-30 15:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-30 10:11 [PATCH v2] scripts/checkpatch.pl: check for placeholders in cover letter patches Manos Pitsidianakis
2024-01-30 10:15 ` Daniel P. Berrangé
2024-01-30 10:26 ` Manos Pitsidianakis
2024-01-30 15:11 ` Alex Bennée [this message]
2024-01-30 15:22 ` Peter Maydell
2024-01-30 19:09 ` Philippe Mathieu-Daudé
2024-01-30 10:34 ` Peter Maydell
2024-01-30 10:39 ` Manos Pitsidianakis
2024-01-30 10:42 ` Peter Maydell
2024-01-30 10:51 ` Manos Pitsidianakis
2024-01-30 10:57 ` Peter Maydell
2024-01-30 11:02 ` Manos Pitsidianakis
2024-01-30 11:24 ` Philippe Mathieu-Daudé
2024-01-30 11:30 ` Peter Maydell
2024-01-30 11:57 ` Philippe Mathieu-Daudé
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=875xzaonzv.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=berrange@redhat.com \
--cc=manos.pitsidianakis@linaro.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).