Skip to content

Commit f526610

Browse files
authored
Merge pull request #43 from jcfr/optimize-error-checking
ENH: Identify error word as valid if additional check succeeds
2 parents 65d081a + 268e815 commit f526610

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

codespell.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ def spell_check_comment(
135135
if len(pre) == len(error_word):
136136
if output_lvl > 1:
137137
print(f"Prefix '{pre}' matches word")
138+
valid = True
138139
break
139140

140141
# remove the prefix
@@ -143,10 +144,14 @@ def spell_check_comment(
143144
print(f"Trying without '{pre}' prefix: {error_word} -> {wrd}")
144145
try:
145146
if spell_checker.check(wrd):
147+
valid = True
146148
break
147149
except BaseException:
148150
print(f"Caught an exception for word {error_word} {wrd}")
149151

152+
if valid:
153+
continue
154+
150155
# Try splitting camel case words and checking each sub-word
151156
if output_lvl > 1:
152157
print(f"Trying splitting camel case word: {error_word}")

0 commit comments

Comments
 (0)