Thread (8 messages) 8 messages, 2 authors, 2020-10-12

[Linux-kernel-mentees] [PATCH RFC] checkpatch: add new exceptions to repeated word check

From: Dwaipayan Ray <dwaipayanray1@gmail.com>
Date: 2020-10-11 06:44:12
Subsystem: checkpatch, the rest · Maintainers: Andy Whitcroft, Joe Perches, Linus Torvalds

The repeated word check generated false positives for
the following pattern:

"git git://..."

This resulted in lots of warnings in the MAINTAINERS file
which shouldn't have been generated.

Fixed this issue by adding "git" to the exception list
for repeated word check.

In addition, modified $word_pattern to capture words which
may contain a single letter like "a".
This ensures that repeated word warning in cases like
"This is a a repetition" are also generated.

Link: https://lore.kernel.org/linux-kernel-mentees/b6cd81b936671a8868fe98536d7c80771bdfd61c.camel@perches.com/ (local)

Suggested-by: Joe Perches <joe@perches.com>
Suggested-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>
---
 scripts/checkpatch.pl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 124ff9432b51..0ef75d2fb5cf 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -588,7 +588,7 @@ our @mode_permission_funcs = (
 	["__ATTR", 2],
 );
 
-my $word_pattern = '\b[A-Z]?[a-z]{2,}\b';
+my $word_pattern = '\b[A-Z]?[a-z]{1,}\b';
 
 #Create a search pattern for all these functions to speed up a loop below
 our $mode_perms_search = "";
@@ -3364,7 +3364,7 @@ sub process {
 				}
 
 				next if ($first ne $second);
-				next if ($first eq 'long');
+				next if ($first =~ /(?:long|git)$/);
 
 				if (WARN("REPEATED_WORD",
 					 "Possible repeated word: '$first'\n" . $herecurr) &&
-- 
2.27.0

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help