-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violations
Description
Summary
I get an error with the autofix for FLY002 when one (or more) of the strings in the join are a raw string:
$ cat ruff_bug.py
'\n'.join([r'line1','line2'])
$ uvx ruff --version
ruff 0.12.8
$ uvx ruff check ruff_bug.py --no-cache --isolated --fix --unsafe-fixes --select FLY002
Installed 1 package in 1ms
error: Fix introduced a syntax error. Reverting all changes.
This indicates a bug in Ruff. If you could open an issue at:
https://github.com/astral-sh/ruff/issues/new?title=%5BFix%20error%5D
...quoting the contents of `ruff_bug.py`, the rule codes FLY002, along with the `pyproject.toml` settings and executed command, we'd be very appreciative!
ruff_bug.py:1:1: FLY002 Consider f-string instead of string join
|
1 | '\n'.join([r'line1','line2'])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FLY002
|
= help: Replace with f-string
Found 1 error.
[*] 1 fixable with the --fix option.Version
ruff 0.12.8
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violations