From: "Denis V. Lunev" <den@openvz.org>
To: qemu-devel@nongnu.org
Cc: "Denis V. Lunev" <den@openvz.org>,
"Alexey Kardashevskiy" <aik@ozlabs.ru>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Eric Blake" <eblake@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>
Subject: [PATCH v2 1/1] scripts: check commit message length to fit 75 characters
Date: Wed, 28 Sep 2022 18:34:17 +0200 [thread overview]
Message-ID: <20220928163417.1839682-1-den@openvz.org> (raw)
There are a lot of commits descriptions which are rendered in the
'git log' with line wrap. Apparently, this is looking awkward. Let us
add check into checkpatch.pl for that.
I am not very good Perl developer, but there is an implementation in
Linux kernel's checkpatch.pl. Linux kernel people have faced a lot of
obstacles here thus direct port from them looks beneficial.
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Alexey Kardashevskiy <aik@ozlabs.ru>
CC: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
CC: "Marc-André Lureau" <marcandre.lureau@redhat.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Eric Blake <eblake@redhat.com>
CC: Markus Armbruster <armbru@redhat.com>
---
Changes from v1:
- fixed formatting to match one in the checkpatch.pl file. That was not
obvious :(
scripts/checkpatch.pl | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d900d18048..fe1ff6c97d 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -36,6 +36,18 @@ my $root;
my %debug;
my $help = 0;
+our $signature_tags = qr{(?xi:
+ Signed-off-by:|
+ Co-developed-by:|
+ Acked-by:|
+ Tested-by:|
+ Reviewed-by:|
+ Reported-by:|
+ Suggested-by:|
+ To:|
+ Cc:
+)};
+
sub help {
my ($exitcode) = @_;
@@ -1303,6 +1315,7 @@ sub process {
my $in_header_lines = $file ? 0 : 1;
my $in_commit_log = 0; #Scanning lines before patch
+ my $commit_log_long_line = 0;
my $reported_maintainer_file = 0;
my $non_utf8_charset = 0;
@@ -1585,6 +1598,19 @@ sub process {
WARN("8-bit UTF-8 used in possible commit log\n" . $herecurr);
}
+ if ($in_commit_log && !$commit_log_long_line && length($line) > 75 &&
+ !($line =~ /^\s*[a-zA-Z0-9_\/\.]+\s+\|\s+\d+/ ||
+ # file delta changes
+ $line =~ /^\s*(?:[\w\.\-\+]*\/)++[\w\.\-\+]+:/ ||
+ # filename then :
+ $line =~ /^\s*(?:Fixes:|Link:|$signature_tags)/i
+ # A Fixes: or Link: line or signature tag line
+ )) {
+ WARN("Possible unwrapped commit description (prefer a maximum " .
+ "75 chars per line)\n" . $herecurr);
+ $commit_log_long_line = 1;
+ }
+
# ignore non-hunk lines and lines being removed
next if (!$hunk_line || $line =~ /^-/);
--
2.34.1
next reply other threads:[~2022-09-28 16:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-28 16:34 Denis V. Lunev [this message]
2022-09-29 11:48 ` [PATCH v2 1/1] scripts: check commit message length to fit 75 characters Markus Armbruster
2022-09-29 13:15 ` Denis V. Lunev
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=20220928163417.1839682-1-den@openvz.org \
--to=den@openvz.org \
--cc=aik@ozlabs.ru \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=f4bug@amsat.org \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).