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 '('
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.
+ WARN("Patch appears to be a cover letter with " .
+ "uninitialized subject '*** SUBJECT
HERE ***'\n$hereline\n");
As is this
+ }
+
+ if ($rawline =~ /^[*]{3} BLURB HERE [*]{3}\s*$/) {
+ WARN("Patch appears to be a cover letter with " .
+ "leftover placeholder text '***
BLURB HERE ***'\n$hereline\n");
And this.
+ }
+
if ($in_commit_log && $non_utf8_charset && $realfile =~ /^$/ &&
$rawline =~ /$NON_ASCII_UTF8/) {
WARN("8-bit UTF-8 used in possible commit log\n" .
$herecurr);
base-commit: 11be70677c70fdccd452a3233653949b79e97908
--
γαῖα πυρί μιχθήτω
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|