lkml.org 
[lkml]   [2020]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3] checkpatch: fix TYPO_SPELLING check for words with apostrophe
From
Date
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

\
 
 \ /
  Last update: 2020-12-01 21:26    [W:0.139 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site