[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1408641520.23250.71.camel@joe-AO725>
Date: Thu, 21 Aug 2014 10:18:40 -0700
From: Joe Perches <joe@...ches.com>
To: Kees Cook <keescook@...omium.org>
Cc: linux-kernel@...r.kernel.org, Andy Whitcroft <apw@...onical.com>,
Andrew Morton <akpm@...ux-foundation.org>,
"David S. Miller" <davem@...emloft.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Mauro Carvalho Chehab <m.chehab@...sung.com>,
Antti Palosaari <crope@....fi>
Subject: Re: [PATCH] checkpatch: look for common misspellings
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@...onical.com>
> M: Joe Perches <joe@...ches.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)/;
}
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists