-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violations
Description
Summary
The fix for missing-required-import (I002) inserts required imports before future imports, which introduces a syntax error. Example:
$ cat >i002.py <<'# EOF'
from __future__ import annotations
# EOF
$ ruff --isolated check i002.py --select I002 --unsafe-fixes --fix --config 'lint.isort.required-imports = ["import this"]'
Found 1 error (1 fixed, 0 remaining).
$ cat i002.py
import this
from __future__ import annotations
$ python i002.py 2>&1 | tail -n 1
SyntaxError: from __future__ imports must occur at the beginning of the fileVersion
ruff 0.13.2 (b0bdf03 2025-09-25)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violations