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

Remove the grave accent (`) from the default word regex #2983

Merged
merged 2 commits into from
Aug 7, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions codespell_lib/_codespell.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# autogenerated by setuptools_scm
from ._version import __version__ as VERSION # type: ignore # noqa: N812

word_regex_def = "[\\w\\-'’`]+"
word_regex_def = r"[\w\-'’]+"
# While we want to treat characters like ( or " as okay for a starting break,
# these may occur unescaped in URIs, and so we are more restrictive on the
# endpoint. Emails are more restrictive, so the endpoint remains flexible.
Expand Down Expand Up @@ -402,7 +402,7 @@ def parse_options(
type=str,
help="regular expression that is used to find words. "
"By default any alphanumeric character, the "
"underscore, the hyphen, and the apostrophe is "
"underscore, the hyphen, and the apostrophe are "
"used to build words. This option cannot be "
"specified together with --write-changes.",
)
Expand Down
4 changes: 2 additions & 2 deletions codespell_lib/data/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12403,7 +12403,7 @@ cought->caught, cough, fought,
coul->could
could'nt->couldn't
could't->couldn't
coulden`t->couldn't
coulden't->couldn't
couldent->couldn't
couldn->could, couldn't,
couldn;t->couldn't
Expand Down Expand Up @@ -48344,7 +48344,7 @@ woudl->would
woudn't->wouldn't
would'nt->wouldn't
would't->wouldn't
woulden`t->wouldn't
woulden't->wouldn't
wouldent->wouldn't
wouldn;t->wouldn't
wouldnt'->wouldn't
Expand Down
10 changes: 10 additions & 0 deletions codespell_lib/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,16 @@ def test_basic(
assert cs.main(tmp_path) == 0


def test_default_word_parsing(
tmp_path: Path,
capsys: pytest.CaptureFixture[str],
) -> None:
fname = tmp_path / "backtick"
with fname.open("a") as f:
f.write("`abandonned`\n")
assert cs.main(fname) == 1, "bad"


def test_bad_glob(
tmp_path: Path,
capsys: pytest.CaptureFixture[str],
Expand Down