Skip to content

ENH: Do not require prefixes to be into additional dict #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions codespell.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ def spell_check_comment(
if spell_checker.check(wrd):
valid = True
break
else:
# Try splitting camel case words and checking each sub-words
if output_lvl > 1:
print("Trying splitting camel case word: {wrd}")
sub_words = splitCamelCase(wrd)
if len(sub_words) > 1 and spell_check_words(
spell_checker, sub_words
):
valid = True
break
except BaseException:
print(f"Caught an exception for word {error_word} {wrd}")

Expand Down
1 change: 1 addition & 0 deletions tests/example.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
//
// Prefix and camel case test word:
// sitkWhiskeyTangoFoxtrot
// myprefixAttributeName
//
// Dictionary test word:
// BinaryFillholeImageFilter
Expand Down
4 changes: 4 additions & 0 deletions tests/test_codespell.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def test_codespell(self):
"--verbose",
"--dict",
"tests/dict.txt",
"--prefix",
"myprefix",
"tests/example.h",
]
)
Expand All @@ -38,6 +40,8 @@ def test_codespell(self):
"python",
"codespell.py",
"--verbose",
"--prefix",
"myprefix",
"--suffix",
".py",
"--suffix",
Expand Down