mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 18:58:04 +00:00
[ruff
] Treat )
as a regex metacharacter (RUF043
, RUF055
) (#15318)
## Summary Resolves #15316. ## Test Plan `cargo nextest run` and `cargo insta test`.
This commit is contained in:
parent
5567e7c26b
commit
e4139568b8
6 changed files with 225 additions and 209 deletions
|
@ -18,6 +18,9 @@ def test_foo():
|
|||
with pytest.raises(EscapedFollowedByUnescaped, match="foo\\.*bar"): ...
|
||||
with pytest.raises(UnescapedFollowedByEscaped, match="foo.\\*bar"): ...
|
||||
|
||||
# https://github.com/astral-sh/ruff/issues/15316
|
||||
with pytest.raises(ClosingParenthesis, match="foo)"): ...
|
||||
|
||||
|
||||
## Metasequences
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ re.sub(r"abc{2,3}", "", s)
|
|||
re.sub(r"abc\n", "", s) # this one could be fixed but is not currently
|
||||
re.sub(r"abc|def", "", s)
|
||||
re.sub(r"(a)bc", "", s)
|
||||
re.sub(r"a)bc", "", s) # https://github.com/astral-sh/ruff/issues/15316
|
||||
|
||||
# and these should not be modified because they have extra arguments
|
||||
re.sub("abc", "", s, flags=re.A)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue