File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -109,6 +109,24 @@ def spell_check_comment(
109109 if output_lvl > 1 :
110110 print (f"Error: { error_word } " )
111111
112+ valid = False
113+
114+ # Check for contractions
115+ for contraction in ["'d" , "'s" , "'th" ]:
116+ if error_word .endswith (contraction ):
117+ original_error_word = error_word
118+ error_word = error_word [: - len (contraction )]
119+ if output_lvl > 1 :
120+ print (
121+ f"Stripping contraction: { original_error_word } -> { error_word } "
122+ )
123+ if spell_checker .check (error_word ):
124+ valid = True
125+ break
126+
127+ if valid :
128+ continue
129+
112130 # Check if the bad word starts with a prefix.
113131 # If so, spell check the word without that prefix.
114132 for pre in prefixes :
@@ -136,12 +154,6 @@ def spell_check_comment(
136154 if len (sub_words ) > 1 and spell_check_words (spell_checker , sub_words ):
137155 continue
138156
139- # Check for possessive words
140- if error_word .endswith ("'s" ):
141- wrd = error_word [:- 2 ]
142- if spell_checker .check (wrd ):
143- continue
144-
145157 if output_lvl > 1 :
146158 msg = f"error: '{ error_word } ', suggestions: { spell_checker .suggest ()} "
147159 else :
Original file line number Diff line number Diff line change 1818//
1919// Additional dictionary test word:
2020// TarHeels
21+ //
22+ // Contraction test words:
23+ // With multiple parameters OR'd to compose the flag.
24+ // With node id's.
25+ // With the itemIndex'th where itemIndex is a variable name.
2126
2227#include <stdio.h>
2328
You can’t perform that action at this time.
0 commit comments