mirror of
https://github.com/codespell-project/codespell.git
synced 2025-08-14 01:58:16 +08:00
Remove the grave accent (`) from the default word regex (#2983)
This commit is contained in:

committed by
GitHub

parent
0d9c92b079
commit
44f22e2436
@ -28,7 +28,7 @@ from typing import Dict, List, Match, Optional, Pattern, Sequence, Set, Tuple
|
||||
# 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.
|
||||
@ -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.",
|
||||
)
|
||||
|
@ -13853,7 +13853,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
|
||||
@ -49897,7 +49897,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
|
||||
|
@ -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],
|
||||
|
Reference in New Issue
Block a user