Skip to content

Commit 938b850

Browse files
authored
Merge pull request #35 from jcfr/tweak-prefix-check
PERF: Skip checking prefixes after one is found to be valid
2 parents 4faaaed + f5e916e commit 938b850

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
@@ -121,15 +121,15 @@ def spell_check_file(filename, spell_checker, mime_type="", output_lvl=1, prefix
121121
if error.word.startswith(pre):
122122
# check if the word is only the prefix
123123
if len(pre) == len(error.word):
124-
continue
124+
break
125125

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

0 commit comments

Comments
 (0)