mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Kees Cook <keescook@chromium.org>
Cc: linux-kernel@vger.kernel.org, Andy Whitcroft <apw@canonical.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"David S. Miller" <davem@davemloft.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Mauro Carvalho Chehab <m.chehab@samsung.com>,
	Antti Palosaari <crope@iki.fi>
Subject: Re: [PATCH] checkpatch: look for common misspellings
Date: Thu, 21 Aug 2014 10:18:40 -0700	[thread overview]
Message-ID: <1408641520.23250.71.camel@joe-AO725> (raw)
In-Reply-To: <20140821162050.GA1323@www.outflux.net>

On Thu, 2014-08-21 at 09:20 -0700, Kees Cook wrote:
> Check for misspellings, based on Debian's lintian list. Several false
> positives were removed, and several additional words added that were
> common in the kernel:
[]
> diff --git a/MAINTAINERS b/MAINTAINERS
[]
> @@ -2311,6 +2311,7 @@ M:	Andy Whitcroft <apw@canonical.com>
>  M:	Joe Perches <joe@perches.com>
>  S:	Maintained
>  F:	scripts/checkpatch.pl
> +F:	scripts/spelling.txt

I don't want to be responsible for misspellings.

Maybe this should be moved to another section
and you could be added as a maintainer for that.
 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> +# Check for several spelling mistakes.
> +		if ($rawline =~ $spelling_re) {

$spelling_re has a rather hidden ( ... ) use so I think
it'd be better to not use spelling_re at all and have a
variable like:
our $misspellings = join('|', @spelling_list);

and also use while so all misspellings are found so this
could be:

		while ($rawline =~ /(?:^|$edge)($misspellings)(?:\$|$edge)/g) {

> +			my $typo = "The word '$1' may be misspelled";
> +			$typo .= " (perhaps you want '$spelling_fix{$1}'?)\n";
> +			WARN("TYPO_SPELLING", $typo . $herecurr);
> +		}
>  	}

Seems sensible, but this checks only .c and .h files.
Any of the Kconfig/.txt files are skipped.

I'd probably leave out "The word "

Maybe add a $fix too?

Maybe:

		while ($rawline =~ /(?:^|$edge)($misspellings)(?:\$|$edge)/g) {
			my $typo = $1;
			if (WARN("TYPO_SPELLING",
				 "$typo may be misspelled - Use '$spelling_fix($typo)'?\n" . $herecurr) &&
			    $fix) {
				$fixed[$fixlinenr] =~ s/(?:^|$edge)($typo)(?:\$|$edge)/$spelling_fix($typo)/;
			}
		}



  reply	other threads:[~2014-08-21 17:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-21 16:20 Kees Cook
2014-08-21 17:18 ` Joe Perches [this message]
2014-08-21 23:01   ` Kees Cook
2014-08-22  0:10     ` Joe Perches
2014-08-22 22:37       ` Joe Perches
2014-08-22 23:00         ` Elliott, Robert (Server Storage)
2014-08-22 23:22           ` Joe Perches
2014-08-22 23:31             ` 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=1408641520.23250.71.camel@joe-AO725 \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=crope@iki.fi \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    /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

all inboxes | Powered by JetHome®