Skip to content
Snippets Groups Projects
Commit e5ecf6b6 authored by Campbell Barton's avatar Campbell Barton
Browse files

check_spelling: support ignoring hyphenated code-words

Words found in the code which were hyphenated were not being ignored,
as is done by non-hyphenated words.
parent e866b96c
No related branches found
No related tags found
No related merge requests found
...@@ -83,7 +83,7 @@ def dictionary_create(): # type: ignore ...@@ -83,7 +83,7 @@ def dictionary_create(): # type: ignore
return dict_spelling return dict_spelling
def dictionary_check(w: str) -> bool: def dictionary_check(w: str, code_words: Set[str]) -> bool:
w_lower = w.lower() w_lower = w.lower()
if w_lower in dict_ignore: if w_lower in dict_ignore:
return True return True
...@@ -106,6 +106,8 @@ def dictionary_check(w: str) -> bool: ...@@ -106,6 +106,8 @@ def dictionary_check(w: str) -> bool:
for w_sub in w_split: for w_sub in w_split:
if w_sub: if w_sub:
if w_sub in code_words:
continue
w_sub_lower = w_sub.lower() w_sub_lower = w_sub.lower()
if w_sub_lower in dict_ignore: if w_sub_lower in dict_ignore:
continue continue
...@@ -454,7 +456,7 @@ def spell_check_file( ...@@ -454,7 +456,7 @@ def spell_check_file(
if w_lower in dict_ignore: if w_lower in dict_ignore:
continue continue
is_good_spelling = dictionary_check(w) is_good_spelling = dictionary_check(w, code_words)
if not is_good_spelling: if not is_good_spelling:
# Ignore literals that show up in code, # Ignore literals that show up in code,
# gets rid of a lot of noise from comments that reference variables. # gets rid of a lot of noise from comments that reference variables.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment