-
Couldn't load subscription status.
- Fork 1.6k
Open
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violations
Description
Summary
The fix for for-loop-set-mutations (FURB142) should parenthesize unparenthesized generator expressions to avoid changing the program’s behavior. Example:
$ cat >furb142.py <<'# EOF'
s = set()
for x in ("abc", "def"):
s.add(c for c in x)
# EOF
$ python furb142.py; echo $?
0
$ ruff check --isolated furb142.py --select FURB142 --preview --fix
Found 1 error (1 fixed, 0 remaining).
$ python furb142.py 2>&1 | tail -n 3
s.update(c for c in x for x in ("abc", "def"))
^
NameError: name 'x' is not definedVersion
ruff 0.14.2 (83a3bc4 2025-10-23)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violations