Skip to content

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

@konstin

Description

@konstin

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixesRelated to suggested fixes for violations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions