Skip to content
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

fix: support hyphens in lexical illusion regex #1344

Merged
merged 1 commit into from
Apr 8, 2023
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
2 changes: 1 addition & 1 deletion proselint/checks/lexical_illusions/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def check(text):
"""Check the text."""
err = "lexical_illusions.misc"
msg = "There's a lexical illusion here: a word is repeated."
regex = r"\b(\w+)(\b\s\1)+\b"
regex = r"\b(?<!\-)(\w+)(\b\s\1)+\b"
exceptions = [r"^had had$", r"^that that$"]

return existence_check(text, [regex], err, msg, exceptions=exceptions,
Expand Down
1 change: 1 addition & 0 deletions tests/test_lexical_illusions.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ def test_smoke(self):
assert self.passes("The practitioner's side")
assert self.passes("An antimatter particle")
assert self.passes("The theory")
assert self.passes("She had coffee at the Foo-bar bar.")