Messages in this thread | | | Subject | Re: [PATCH v3] checkpatch: fix TYPO_SPELLING check for words with apostrophe | From | Joe Perches <> | Date | Tue, 01 Dec 2020 12:25:11 -0800 |
| |
On Tue, 2020-12-01 at 11:32 -0800, Joe Perches wrote: > On Wed, 2020-12-02 at 00:37 +0530, Dwaipayan Ray wrote: > > checkpatch reports a false TYPO_SPELLING warning for some words > > containing an apostrophe when run with --codespell option.
Hey Andrew. If Dwaipayan doesn't mind, can you update this when you apply it to extend the length of the caret printed?
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > > @@ -3106,15 +3106,18 @@ sub process { > > # Check for various typo / spelling mistakes > > if (defined($misspellings) && > > ($in_commit_log || $line =~ /^(?:\+|Subject:)/i)) { > > - while ($rawline =~ /(?:^|[^a-z@])($misspellings)(?:\b|$|[^a-z@])/gi) { > > + while ($rawline =~ /(?:^|[^\w\-'`])($misspellings)(?:[^\w\-'`]|$)/gi) { > > my $typo = $1; > > + my $blank = copy_spacing($rawline); > > + my $ptr = substr($blank, 0, $-[1]) . "^";
Changing this to:
my $ptr = substr($blank, 0, $-[1]) . "^" x length($typo);
makes the matched misspelling more obvious
Thanks, Joe
| |