Skip to content

Commit

Permalink
checkpatch: add --spelling option to check spelling in source files
Browse files Browse the repository at this point in the history
Before this change, spelling in source files was not checked, and it was
only possible to enable spelling checks via --strict / --subjective.

Signed-off-by: Evgueni Souleimanov <[email protected]>
  • Loading branch information
esoule committed Aug 26, 2018
1 parent fe78900 commit 7e81066
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
my $ignore_perl_version = 0;
my $minimum_perl_version = 5.10.0;
my $min_conf_desc_length = 4;
my $spelling_warn = 0;
my $spelling_file = "$D/spelling.txt";
my $codespell = 0;
my $codespellfile = "/usr/share/codespell/dictionary.txt";
Expand Down Expand Up @@ -110,6 +111,7 @@ sub help {
file. It's your fault if there's no backup or git
--ignore-perl-version override checking of perl version. expect
runtime errors.
--spelling Warn about typos and spelling problems
--codespell Use the codespell dictionary for spelling/typos
(default:/usr/share/codespell/dictionary.txt)
--codespellfile Use this codespell dictionary
Expand Down Expand Up @@ -206,6 +208,7 @@ sub list_types {
'ignore-perl-version!' => \$ignore_perl_version,
'debug=s' => \%debug,
'test-only=s' => \$tst_only,
'spelling!' => \$spelling_warn,
'codespell!' => \$codespell,
'codespellfile=s' => \$codespellfile,
'color!' => \$color,
Expand Down Expand Up @@ -2663,6 +2666,7 @@ sub process {
$typo_fix = uc($typo_fix) if ($typo =~ /^[A-Z]+$/);
my $msg_type = \&WARN;
$msg_type = \&CHK if ($file);
$msg_type = \&WARN if ($spelling_warn);
if (&{$msg_type}("TYPO_SPELLING",
"'$typo' may be misspelled - perhaps '$typo_fix'?\n" . $herecurr) &&
$fix) {
Expand Down

0 comments on commit 7e81066

Please sign in to comment.