Hello, thanks for such a great package!
When fixing C419 with --unsafe-fixes on .py file with trailing comma, the fixed code sometimes causes syntax error, because the trailing comma is not removed.
A minimal code snippet that reproduces the bug.
- Save the following contents to
example.py:
any([i for i in [1, 2]],)
- Execute the following contents:
ruff check example.py --select C419 --isolated --unsafe-fixes --fix
- Now,
example.py has the following contents:
- Then,
python example.py causes syntax error:
File "/path/to/example.py", line 1
any(i for i in [1, 2],)
^^^^^^^^^^^^^^^^^
SyntaxError: Generator expression must be parenthesized
Additional information
List of keywords you searched for before creating this issue.
The current Ruff settings
The current Ruff version