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 <a...@canonical.com>
>  M:   Joe Perches <j...@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)/;
                        }
                }


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to