[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51648015c2032c0b6fc9b10c6420cf73c4a93846.camel@perches.com>
Date: Tue, 22 Jul 2025 10:58:11 -0700
From: Joe Perches <joe@...ches.com>
To: Ignacio Peña <ignacio.pena87@...il.com>, Andy
Whitcroft <apw@...onical.com>
Cc: Dwaipayan Ray <dwaipayanray1@...il.com>, Lukas Bulwahn
<lukas.bulwahn@...il.com>, linux-kernel@...r.kernel.org, Greg Kroah-Hartman
<gregkh@...uxfoundation.org>
Subject: Re: [PATCH 1/3] checkpatch: warn about novice phrases in commit
messages
On Mon, 2025-07-21 at 12:24 -0400, Ignacio Peña wrote:
> Add detection for common phrases used by newcomers that make patches
> look less professional, such as "please apply" or "please consider".
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -3266,6 +3266,26 @@ sub process {
> "A patch subject line should describe the change not the tool that found it\n" . $herecurr);
> }
>
> +
> +# Check for novice phrases in commit message
> + if ($in_commit_log && !$non_utf8_charset) {
why !$non_utf8_charset?
> + my @novice_phrases = (
> + qr/please\s+(apply|merge|consider|review)/i,
> + qr/hope\s+this\s+helps/i,
> + qr/my\s+first\s+(patch|contribution)/i,
> + qr/(newbie|beginner)\s+here/i,
> + qr/not\s+sure\s+if\s+(this\s+is\s+)?correct/i,
> + qr/sorry\s+(if|for)/i,
> + );
No capture groups - use (?:..)
> + foreach my $phrase (@novice_phrases) {
> + if ($line =~ /$phrase/) {
> + WARN("COMMIT_MESSAGE_NOVICE",
> + "Avoid apologetic or uncertain language - be direct and professional\n" . $herecurr);
> + last;
> + }
> + }
> + }
And this could like use a single search rather than a list like:
my $novice_phrases = qr{(?xi:
please\s+(?:apply|merge|consider|review) |
hope\s+this\s+helps |
my\s+first\s+(?:patch|contribution) |
(?:newbie|beginner)\s+here |
not\s+sure\s+if\s+(?:this\s+is\s+)?correct |
sorry\s+(?:if|for)
)};
if ($line =~ /\b$novice_phrase\b/) {
WARN("COMMIT_MESSAGE_NOVICE",
"Avoid apologetic or uncertain language - be direct\n" . $herecurr);
}
IMO professional is unnecessary.
Powered by blists - more mailing lists