[Linux-kernel-mentees] [PATCH] checkpatch: Adjust spelling check false positive

Mrinal Pandey mrinalmni at gmail.com
Mon Jul 6 08:08:14 UTC 2020


checkpatch.pl issues warnings on the commits
made to scripts/spelling.txt for new entries
of typos and their fixes. This commit adjusts
checkpatch not to complain about the same.

Signed-off-by: Mrinal Pandey <mrinalmni at gmail.com>
---
 scripts/checkpatch.pl | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 3cacc122c528..538776faa96d 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2994,14 +2994,16 @@ sub process {
 			while ($rawline =~ /(?:^|[^a-z@])($misspellings)(?:\b|$|[^a-z@])/gi) {
 				my $typo = $1;
 				my $typo_fix = $spelling_fix{lc($typo)};
-				$typo_fix = ucfirst($typo_fix) if ($typo =~ /^[A-Z]/);
-				$typo_fix = uc($typo_fix) if ($typo =~ /^[A-Z]+$/);
-				my $msg_level = \&WARN;
-				$msg_level = \&CHK if ($file);
-				if (&{$msg_level}("TYPO_SPELLING",
-						  "'$typo' may be misspelled - perhaps '$typo_fix'?\n" . $herecurr) &&
-				    $fix) {
-					$fixed[$fixlinenr] =~ s/(^|[^A-Za-z@])($typo)($|[^A-Za-z@])/$1$typo_fix$3/;
+				if ("+$typo||$typo_fix" ne $rawline) {
+					$typo_fix = ucfirst($typo_fix) if ($typo =~ /^[A-Z]/);
+					$typo_fix = uc($typo_fix) if ($typo =~ /^[A-Z]+$/);
+					my $msg_level = \&WARN;
+					$msg_level = \&CHK if ($file);
+					if (&{$msg_level}("TYPO_SPELLING",
+							  "'$typo' may be misspelled - perhaps '$typo_fix'?\n" . $herecurr) &&
+					    $fix) {
+						$fixed[$fixlinenr] =~ s/(^|[^A-Za-z@])($typo)($|[^A-Za-z@])/$1$typo_fix$3/;
+					}
 				}
 			}
 		}
-- 
2.25.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.linuxfoundation.org/pipermail/linux-kernel-mentees/attachments/20200706/8a6856d1/attachment.sig>


More information about the Linux-kernel-mentees mailing list