From 82e4b979ab424cad429a751a9a90c0e0c6ea077e Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Fri, 6 Aug 2021 13:37:44 +1000 Subject: [PATCH] check_spelling: allow joining hyphenated words Accept the spelling for hyphenated words when the spelling of each individual word is correct. This suppresses many terms that are better treated as false positives such as user-defined, multi-input and edit-data. --- check_source/check_spelling.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/check_source/check_spelling.py b/check_source/check_spelling.py index 7d55384..3fa5780 100755 --- a/check_source/check_spelling.py +++ b/check_source/check_spelling.py @@ -406,8 +406,17 @@ def spell_check_file( if w_lower in dict_custom or w_lower in dict_ignore: continue - if not dict_spelling.check(w): - + is_good_spelling = dict_spelling.check(w) + if not is_good_spelling: + if "-" in w: + is_good_spelling = True + for w_sub in w.split("-"): + if w_sub: + if not dict_spelling.check(w_sub): + is_good_spelling = False + break + + if not is_good_spelling: # Ignore literals that show up in code, # gets rid of a lot of noise from comments that reference variables. if w in code_words: -- GitLab