From: Joe Perches <joe@perches.com>
To: Dwaipayan Ray <dwaipayanray1@gmail.com>
Cc: linux-kernel-mentees@lists.linuxfoundation.org,
linux-kernel@vger.kernel.org, lukas.bulwahn@gmail.com,
yashsri421@gmail.com
Subject: Re: [PATCH v4] checkpatch: improve email parsing
Date: Fri, 06 Nov 2020 14:03:59 -0800 [thread overview]
Message-ID: <38c2889ad15c0f34ce8c223518f1f6dbc9945286.camel@perches.com> (raw)
In-Reply-To: <20201106214530.367247-1-dwaipayanray1@gmail.com>
On Sat, 2020-11-07 at 03:15 +0530, Dwaipayan Ray wrote:
> checkpatch doesn't report warnings for many common mistakes
> in emails. Some of which are trailing commas and incorrect
> use of email comments.
Assuming it all works, this looks good. I haven't tested it.
How did you test the $fix bits?
Trivial notes:
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> + # stable@vger.kernel.org or stable@kernel.org shouldn't
> + # have an email name. In addition commments should strictly
> + # begin with a #
> + if ($email =~ /^.*stable\@(?:vger\.)?kernel\.org/) {
Likely better to test with a case insensitive match so
STABLE@vger.kernel.org and such are still warned.
if ($email =~ /\bstable\@(?:vger\.)?kernel\.org\b/i) {
> + if ($sign_off =~ /cc:$/i && (($comment ne "" && $comment !~ /^#.+/) ||
> + ($email_name ne ""))) {
|| $sign_off !~ /^cc:/i ?
> + my $cur_name = $email_name;
> + my $new_comment = $comment;
> +
> + $cur_name =~ s/[a-zA-Z\s\-\"]+//g;
> + $new_comment =~ s/^[\s\#\(\[]+|[\s\)\]]+$//g;
> + $new_comment = trim("$new_comment $cur_name") if $cur_name ne $new_comment;
> + $new_comment = " # $new_comment" if length($new_comment) > 0;
> + my $new_email = "$email_address$new_comment";
> +
> + if (WARN("BAD_SIGN_OFF",
> + "Invalid email format for stable: '$email', prefer '$new_email'\n" . $herecurr) &&
These message lines should be aligned to the next open parenthesis
(7 tabs, 1 space)
> + $fix) {
> + $fixed[$fixlinenr] =~ s/\Q$email\E/$new_email/;
> + }
As a cc to stable isn't a sign-off, perhaps this should be a different
"BAD_<FOO>" like "BAD_STABLE_ADDRESS_STYLE" or such.
> + }
> + } else {
elsif ?
> + if ($comment ne "" && $comment !~ /^(?:#.+|\(.+\))$/) {
> + if (WARN("BAD_SIGN_OFF",
> + "Unexpected content after email: '$email'\n" . $herecurr) &&
7 tabs, 1 space
> + $fix) {
> + my $new_comment = $comment;
> + $new_comment =~ s/^(?:\/\*|\.|\,)//g;
> + $new_comment =~ s/^[\s\{\[]+|[\s\}\]]+$//g;
> + $new_comment = " ($new_comment)" if length($new_comment) > 0;
> + $fixed[$fixlinenr] =~ s/\s*\Q$comment\E$/$new_comment/;
> + }
> + }
> }
> }
>
>
next prev parent reply other threads:[~2020-11-06 22:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-06 21:45 Dwaipayan Ray
2020-11-06 22:03 ` Joe Perches [this message]
2020-11-07 4:41 ` Dwaipayan Ray
2020-11-07 5:09 ` Joe Perches
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=38c2889ad15c0f34ce8c223518f1f6dbc9945286.camel@perches.com \
--to=joe@perches.com \
--cc=dwaipayanray1@gmail.com \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas.bulwahn@gmail.com \
--cc=yashsri421@gmail.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
all inboxes | Powered by JetHome®