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

[Autofix error] RUF010 autofix fails when the expression is in parentheses, e.g. f"{(str(a))}" #4520

Closed
konstin opened this issue May 19, 2023 · 2 comments · Fixed by #4524
Closed
Labels
fixes Related to suggested fixes for violations

Comments

@konstin
Copy link
Member

konstin commented May 19, 2023

RUF010 creates an invalid autofix when the expression is already in parentheses, e.g.

f"{(str(a))}"

is replaced by

f"{(a!s)}"

which is invalid syntax.

Command:

ruff --no-cache --select RUF010 --fix code.py

ruff version fd16d65

@konstin konstin added the fixes Related to suggested fixes for violations label May 19, 2023
@JonathanPlasse
Copy link
Contributor

This version of RUF010 using libcst should not have this problem.
ec263ce (#4423)

@JonathanPlasse
Copy link
Contributor

I will make a PR soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixes Related to suggested fixes for violations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants