Skip to content

Commit a1b2cd7

Browse files
committed
Fixed bug. Reformated print messages.
1 parent d4f4367 commit a1b2cd7

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

comment_spell_check/comment_spell_check.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def spell_check_comment(
136136
error_word = error.word
137137

138138
if output_lvl > 1:
139-
print(f"Error: {error_word}")
139+
print(f" Error: {error_word}")
140140

141141
valid = False
142142

@@ -147,7 +147,7 @@ def spell_check_comment(
147147
error_word = error_word[: -len(contraction)]
148148
if output_lvl > 1:
149149
print(
150-
f"Stripping contraction: {original_error_word} -> {error_word}"
150+
f" Stripping contraction: {original_error_word} -> {error_word}"
151151
)
152152
if spell_checker.check(error_word):
153153
valid = True
@@ -167,42 +167,44 @@ def spell_check_comment(
167167
# check if the word is only the prefix
168168
if len(pre) == len(error_word):
169169
if output_lvl > 1:
170-
print(f"Prefix '{pre}' matches word")
170+
print(f" Prefix '{pre}' matches word")
171171
valid = True
172172
break
173173

174174
# remove the prefix
175175
wrd = error_word[len(pre) :]
176176
if output_lvl > 1:
177-
print(f"Trying without '{pre}' prefix: {error_word} -> {wrd}")
177+
print(f" Trying without '{pre}' prefix: {error_word} -> {wrd}")
178178
try:
179179
if spell_checker.check(wrd):
180180
valid = True
181181
else:
182182
# Try splitting camel case words and checking each sub-words
183183
if output_lvl > 1:
184-
print("Trying splitting camel case word: {wrd}")
184+
print(f" Trying splitting camel case word: {wrd}")
185185
sub_words = split_camel_case(wrd)
186+
if output_lvl > 1:
187+
print(" Sub-words: ", sub_words)
186188
if len(sub_words) > 1 and spell_check_words(
187189
spell_checker, sub_words
188190
):
189191
valid = True
190192
break
191193
except TypeError:
192-
print(f"Caught an exception for word {error_word} {wrd}")
194+
print(f" Caught an exception for word {error_word} {wrd}")
193195

194196
if valid:
195197
continue
196198

197199
# Try splitting camel case words and checking each sub-word
198200
if output_lvl > 1:
199-
print(f"Trying splitting camel case word: {error_word}")
200-
sub_words = get_mime_type(error_word)
201+
print(f" Trying splitting camel case word: {error_word}")
202+
sub_words = split_camel_case(error_word)
201203
if len(sub_words) > 1 and spell_check_words(spell_checker, sub_words):
202204
continue
203205

204206
if output_lvl > 1:
205-
msg = f"error: '{error_word}', suggestions: {spell_checker.suggest()}"
207+
msg = f" Error: '{error_word}', suggestions: {spell_checker.suggest()}"
206208
else:
207209
msg = error_word
208210
mistakes.append(msg)

0 commit comments

Comments
 (0)