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] FLY002 fails with f"{', '.join([])}" #4321

Closed
konstin opened this issue May 9, 2023 · 0 comments · Fixed by #4487
Closed

[Autofix error] FLY002 fails with f"{', '.join([])}" #4321

konstin opened this issue May 9, 2023 · 0 comments · Fixed by #4487
Labels
bug Something isn't working fixes Related to suggested fixes for violations

Comments

@konstin
Copy link
Member

konstin commented May 9, 2023

In ruff 99a755f, the following snippet causes the autofix FLY002 from the flynt rules to introduce a syntax error:

f"{', '.join([])}"
$ ./ruff --no-cache --select FLY002 --fix code.py

error: Autofix introduced a syntax error. Reverting all changes.

This indicates a bug in `ruff`. If you could open an issue at:

    https://github.com/charliermarsh/ruff/issues/new?title=%5BAutofix%20error%5D

...quoting the contents of `code.py`, the rule codes FLY002, along with the `pyproject.toml` settings and executed command, we'd be very appreciative!

code.py:1:4: FLY002 Consider `f""` instead of string join
Found 1 error.

This was originally discovered in https://github.com/aws/aws-sam-cli/blob/abb6fd069ce79668c7a811758a732970c5be1a66/samcli/commands/init/command.py#L161

@konstin konstin added bug Something isn't working fixes Related to suggested fixes for violations autofix-error labels May 9, 2023
@konstin konstin changed the title [Autofix error] FLY002 fails with f"{' '}" [Autofix error] FLY002 fails with f"{', '.join([])}" May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixes Related to suggested fixes for violations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant