linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>, linux-kernel@vger.kernel.org
Subject: [PATCH] checkpatch: Avoid missing typo suggestions
Date: Wed, 3 Jun 2020 16:19:01 -0700	[thread overview]
Message-ID: <202006031618.DA25142@keescook> (raw)

My codespell dictionary has a lot of capitalized words. For example:

MSDOS->MS-DOS

Since checkpatch uses case-insensitive matching, I get an undefined
variable warning and then empty suggestions for things like this:

Use of uninitialized value $typo_fix in concatenation (.) or string at ./scripts/checkpatch.pl line 2958.

WARNING: 'msdos' may be misspelled - perhaps ''?
+       struct msdos_dir_entry *de;

This fixes the matcher to avoid the warning, but it's still a rather
silly suggestion:

WARNING: 'msdos' may be misspelled - perhaps 'MS-DOS'?
+       struct msdos_dir_entry *de;

So I'm not really sure what to do with this ... filter out bad
suggestions instead?

Cc: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e9f8146600d0..1aaf3317b6ad 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -727,7 +727,7 @@ if ($codespell) {
 
 			my ($suspect, $fix) = split(/->/, $line);
 
-			$spelling_fix{$suspect} = $fix;
+			$spelling_fix{lc($suspect)} = $fix;
 		}
 		close($spelling);
 	} else {
-- 
2.25.1


-- 
Kees Cook

             reply	other threads:[~2020-06-03 23:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03 23:19 Kees Cook [this message]
2020-06-04  0:39 ` [PATCH] checkpatch: Avoid missing typo suggestions Joe Perches
2020-06-04  6:55   ` Maxim Uvarov
2020-06-04  7:29     ` Joe Perches
2020-06-04 14:45       ` Maxim Uvarov
2020-06-04 22:08   ` Kees Cook
2020-06-05  1:02     ` Joe Perches
2020-06-05  3:05       ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202006031618.DA25142@keescook \
    --to=keescook@chromium.org \
    --cc=apw@canonical.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).