Skip to content

RUF037 fix should add spaces between tokens #18552

@dscorbett

Description

@dscorbett

Summary

The fix for unnecessary-empty-iterable-within-deque-call (RUF037) can introduce a syntax error when deque is parenthesized and preceded by a keyword without intervening white space.

$ cat >ruf037.py <<'# EOF'
from collections import deque
0 or(deque)([])
# EOF

$ ruff --isolated check ruf037.py --select RUF037 --preview --diff 2>&1 | grep error:
error: Fix introduced a syntax error. Reverting all changes.

Version

ruff 0.11.13 (5faf72a 2025-06-05)

Metadata

Metadata

Assignees

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