-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add new rule to check for useless quote escapes #8630
Add new rule to check for useless quote escapes #8630
Conversation
crates/ruff_linter/src/rules/flake8_quotes/rules/avoidable_escaped_quote.rs
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/flake8_quotes/rules/avoidable_escaped_quote.rs
Outdated
Show resolved
Hide resolved
637452a
to
7f0bf50
Compare
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
Q004 | 1 | 1 | 0 | 0 | 0 |
Formatter (stable)
✅ ecosystem check detected no format changes.
Formatter (preview)
✅ ecosystem check detected no format changes.
Haven't reviewed the code yet, but the ecosystem check seems to be flagging some cases like |
Yeah, just noticed that I'm not checking for escaped backslashes - already on it |
Awesome, thanks @ThiefMaster! |
bc64a73
to
ac6b617
Compare
crates/ruff_linter/src/rules/flake8_quotes/rules/avoidable_escaped_quote.rs
Outdated
Show resolved
Hide resolved
ac6b617
to
e90a3bf
Compare
Ecosystems looks much better now. The one new violation is actually correct since those quotes there should not be escaped. |
e90a3bf
to
e188954
Compare
The mkdocs CI failure seems unrelated (it didn't fail until I rebased to the latest master). |
e188954
to
7b36ebe
Compare
7b36ebe
to
65163b5
Compare
crates/ruff_linter/resources/test/fixtures/flake8_quotes/doubles_escaped_unnecessary.py
Outdated
Show resolved
Hide resolved
be9cf4e
to
c6de455
Compare
When using the autofixer for
Q000
it does not remove the backslashes from quotes that no longer need escaping.This new rule checks for such backslashes (regardless whether they come from the autofixer or not) and can remove them.
I used
Q100
to avoid ocnflicts withQ00x
rulesflake8-quotes
might add (even though it's not very actively maintained)fixes #8617