@@ -113,10 +113,13 @@ def spell_check_words(spell_checker: SpellChecker, words: list[str]):
113113 return False
114114 return True
115115
116- def find_misspellings (spell : SpellChecker , line : str , verbose : bool = False ) -> list [str ]:
116+
117+ def find_misspellings (
118+ spell : SpellChecker , line : str , verbose : bool = False
119+ ) -> list [str ]:
117120 """Find misspellings in a line of text."""
118121
119- l2 = re .sub (r' [^a-zA-Z]' , ' ' , line )
122+ l2 = re .sub (r" [^a-zA-Z]" , " " , line )
120123 words = l2 .split ()
121124
122125 mistakes = []
@@ -128,6 +131,7 @@ def find_misspellings(spell: SpellChecker, line: str, verbose: bool = False) ->
128131 mistakes .append (word )
129132 return mistakes
130133
134+
131135def spell_check_comment (
132136 spell : SpellChecker ,
133137 c : comment_parser .common .Comment ,
@@ -191,9 +195,7 @@ def spell_check_comment(
191195 if output_lvl > 1 :
192196 print ("Trying splitting camel case word: {wrd}" )
193197 sub_words = split_camel_case (wrd )
194- if len (sub_words ) > 1 and spell_check_words (
195- spell , sub_words
196- ):
198+ if len (sub_words ) > 1 and spell_check_words (spell , sub_words ):
197199 valid = True
198200 break
199201 except TypeError :
@@ -459,6 +461,7 @@ def add_bibtex_words(spell, bibtex_files, verbose=False):
459461 print (f"Loading bibtex file: { bibtex_file } " )
460462 bibtex_loader .add_bibtex (spell , bibtex_file , verbose = verbose )
461463
464+
462465def main ():
463466 """comment_spell_check main function."""
464467 args = parse_args ()
@@ -475,7 +478,7 @@ def main():
475478
476479 dict_list = build_dictionary_list (args )
477480
478- spell = create_checker .create_checker (dict_list , output_lvl > 1 )
481+ spell = create_checker .create_checker (dict_list , output_lvl > 1 )
479482
480483 if args .bibtex :
481484 add_bibtex_words (spell , args .bibtex , verbose = output_lvl > 1 )
0 commit comments