-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Closed
Copy link
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violationshelp wantedContributions especially welcomeContributions especially welcome
Description
Summary
match_semicolon does not recognize U+000C FORM FEED as white space. That makes the fix for missing-required-import (I002) insert the required import on the next line instead of after the semicolon, which can introduce a syntax error. Example:
$ cat >i002.py <<'# EOF'
"docstring"; print(
f"{__doc__=}",
)
# EOF
$ ruff --isolated check --config 'lint.isort.required-imports=["import sys"]' i002.py --select I002 --diff 2>&1 | grep error:
error: Fix introduced a syntax error. Reverting all changes.There is a form feed before the semicolon in that example. Some browsers hide control characters. Hopefully it’s still there if you copy and paste it.
Version
ruff 0.12.3 (5bc81f2 2025-07-11)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violationshelp wantedContributions especially welcomeContributions especially welcome