Skip to content

Commit f5e916e

Browse files
committed
PERF: Skip checking prefixes after one is found to be valid
This commit is a follow-up of d4ff3ad (added multiple files and prefix checks)
1 parent d96a871 commit f5e916e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

codespell.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,15 @@ def spell_check_file(filename, spell_checker, mime_type="", output_lvl=1, prefix
120120
if error.word.startswith(pre):
121121
# check if the word is only the prefix
122122
if len(pre) == len(error.word):
123-
continue
123+
break
124124

125125
# remove the prefix
126126
wrd = error.word[len(pre) :]
127127
if output_lvl > 1:
128128
print("Trying without prefix: ", error.word, wrd)
129129
try:
130130
if spell_checker.check(wrd):
131-
continue
131+
break
132132
except BaseException:
133133
print("Caught an exception for word", error.word, wrd)
134134

0 commit comments

Comments
 (0)