-
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
Fixing yield-in-for-loop (UP028) fails in Ruff 0.9.2 when the iterable expression is an unparenthesized tuple.
$ cat up028.py
def f(x):
for e in x,:
yield e
$ ruff --isolated check --select UP028 --unsafe-fixes --fix up028.py
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 `up028.py`, the rule codes UP028, along with the `pyproject.toml` settings and executed command, we'd be very appreciative!
up028.py:2:5: UP028 Replace `yield` over `for` loop with `yield from`
|
1 | def f(x):
2 | / for e in x,:
3 | | yield e
| |_______________^ UP028
|
= help: Replace with `yield from`
Found 1 error.
[*] 1 fixable with the --fix option.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