-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violations
Description
Summary
If a quoted annotation contains a newline escape (\n) before a comment (#), the fix for quoted-annotation (UP037) will cause a syntax error playground:
PS ~>echo @'
from __future__ import annotations
def foo(bar: "A\n#"): ...
'@ | uvx ruff check --select UP037 - --fix 2>&1 | rg "syntax error"
error: Fix introduced a syntax error. Reverting all changes.The fix works fine if the newline is instead added using a multiline string, so (completely guessing) this might be fixable by making these cases also take that code path.
PS ~>echo @'
from __future__ import annotations
def foo(bar: """A
#"""): ...
'@ | uvx ruff check --select UP037 - --fix
from __future__ import annotations
def foo(bar: (A
#
)): ...
Found 1 error (1 fixed, 0 remaining).Version
ruff 0.12.8 (f51a228 2025-08-07)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violations