scripts/checkpatch.pl | 8 ++++++++ 1 file changed, 8 insertions(+)
Add detection for common phrases that make patches appear less
confident. These phrases are often used by newcomers and can make
their contributions seem less professional or uncertain.
The regex uses qr{} syntax as suggested for better readability and
potential pre-compilation benefits.
Examples of detected phrases:
- 'please apply/merge/consider/review'
- 'hope this helps'
- 'my first patch/contribution'
- 'newbie/beginner here'
- 'not sure if (this is) correct'
- 'sorry if/for'
This helps newcomers learn the expected communication style in
kernel development, where direct and confident communication is
preferred.
Link: https://docs.kernel.org/process/submitting-patches.html#describe-your-changes
Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Ignacio Peña <ignacio.pena87@gmail.com>
---
Changes in v3:
- Use qr{} syntax instead of // for the regex (Joe Perches)
- Remove comment about the suggestion (Joe Perches)
- Drop the SHA enforcement patch based on maintainer feedback
Changes in v2:
- Combined multiple regexes into single expression with non-capturing groups
- Changed warning message from 'professional' to 'confident'
---
scripts/checkpatch.pl | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e722dd6fa..ac270f35b 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3266,6 +3266,14 @@ 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) {
+ if ($line =~ qr{\b(?: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))\b}i) {
+ WARN("COMMIT_MESSAGE_NOVICE",
+ "Avoid apologetic or uncertain language - be direct and confident\n" . $herecurr);
+ }
+ }
+
# Check for Gerrit Change-Ids not in any patch context
if ($realfile eq '' && !$has_patch_separator && $line =~ /^\s*change-id:/i) {
if (ERROR("GERRIT_CHANGE_ID",
--
2.50.1
On Wed, 2025-07-23 at 23:28 -0400, Ignacio Peña wrote: > Add detection for common phrases that make patches appear less > confident. These phrases are often used by newcomers and can make > their contributions seem less professional or uncertain. > > The regex uses qr{} syntax as suggested for better readability and > potential pre-compilation benefits. Unneessary paragraph. > > Examples of detected phrases: > - 'please apply/merge/consider/review' > - 'hope this helps' > - 'my first patch/contribution' > - 'newbie/beginner here' > - 'not sure if (this is) correct' > - 'sorry if/for' > > This helps newcomers learn the expected communication style in > kernel development, where direct and confident communication is > preferred. > > Link: https://docs.kernel.org/process/submitting-patches.html#describe-your-changes > Suggested-by: Joe Perches <joe@perches.com> I did not suggest this. I am merely trying to improve the patch and its readability. I do not need to have any credit for this. > Signed-off-by: Ignacio Peña <ignacio.pena87@gmail.com> > --- > Changes in v3: > - Use qr{} syntax instead of // for the regex (Joe Perches) > - Remove comment about the suggestion (Joe Perches) > - Drop the SHA enforcement patch based on maintainer feedback This last line should be part of a cover letter to the patch set rather than added to this specific patch. > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > @@ -3266,6 +3266,14 @@ 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) { You still haven't answered why $!non_utf8_charset is useful. > + if ($line =~ qr{\b(?: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))\b}i) { And this is still not human readable. I much prefer describing each phrase on a separate line 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/) {
© 2016 - 2025 Red Hat, Inc.