[PATCH v4] checkpatch: warn about novice phrases in commit messages

Ignacio Peña posted 1 patch 2 months, 1 week ago
scripts/checkpatch.pl | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
[PATCH v4] checkpatch: warn about novice phrases in commit messages
Posted by Ignacio Peña 2 months, 1 week ago
Add warnings for common phrases that indicate uncertainty or lack of
confidence in commit messages.

Signed-off-by: Ignacio Peña <ignacio.pena87@gmail.com>
---
 scripts/checkpatch.pl | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index ac270f35b..f79a525a7 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3430,6 +3430,24 @@ sub process {
 			     "Use lore.kernel.org archive links when possible - see https://lore.kernel.org/lists.html\n" . $herecurr);
 		}
 
+# Check for novice phrases in commit messages
+		if ($in_commit_log && !$non_utf8_charset) {
+			my $novice_phrases = qr{(?:^|\s)(?i)(
+				I\s+think|
+				I\s+believe|
+				I\s+suppose|
+				probably|
+				maybe|
+				perhaps|
+				possibly|
+				hopefully
+			)(?:\s|$)}x;
+			if ($line =~ /$novice_phrases/) {
+				WARN("NOVICE_PHRASE",
+				     "Avoid uncertainty phrases like '$1' in commit messages\n" . $herecurr);
+			}
+		}
+
 # Check for added, moved or deleted files
 		if (!$reported_maintainer_file && !$in_commit_log &&
 		    ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ ||
-- 
2.50.1

Re: [PATCH v4] checkpatch: warn about novice phrases in commit messages
Posted by Joe Perches 2 months, 1 week ago
On Tue, 2025-07-29 at 10:07 -0400, Ignacio Peña wrote:
> Add warnings for common phrases that indicate uncertainty or lack of
> confidence in commit messages.
> 
> Signed-off-by: Ignacio Peña <ignacio.pena87@gmail.com>
> ---
>  scripts/checkpatch.pl | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)

-ENOCHANGELOG

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -3430,6 +3430,24 @@ sub process {
>  			     "Use lore.kernel.org archive links when possible - see https://lore.kernel.org/lists.html\n" . $herecurr);
>  		}
>  
> +# Check for novice phrases in commit messages
> +		if ($in_commit_log && !$non_utf8_charset) {
> +			my $novice_phrases = qr{(?:^|\s)(?i)(
> +				I\s+think|
> +				I\s+believe|
> +				I\s+suppose|
> +				probably|
> +				maybe|
> +				perhaps|
> +				possibly|
> +				hopefully

definite nak.

maybe is used way too often.

Where did you get these word choices?

What happened to the "my first kernel patch" phrases?

And you have not ever answered why !$non_utf8_charset is useful.

> +			)(?:\s|$)}x;
> +			if ($line =~ /$novice_phrases/) {

this should be
			if ($line =~ /\b$novice_phrases\b/) {

> +				WARN("NOVICE_PHRASE",
> +				     "Avoid uncertainty phrases like '$1' in commit messages\n" . $herecurr);
> +			}
> +		}
> +
>  # Check for added, moved or deleted files
>  		if (!$reported_maintainer_file && !$in_commit_log &&
>  		    ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ ||