forward-annotation-syntax-error
What it does
Section titled “What it does”Reports a quoted annotation whose text is not an expression.
Why it matters
Section titled “Why it matters”Type checkers and typing.get_type_hints parse the string as an expression. A string that is not one fails there, though Python itself never looks at it when the code runs, so the mistake hides until a tool evaluates the annotation.
To fix, correct the text of the annotation.
Example
Section titled “Example”...
def annotations(a: "Missing", b: "bad syntax here"): x: int...
...Configuration
Section titled “Configuration”python: lint: rules: forward-annotation-syntax-error: warn # off, warn (default), errorSuppress one line with sudsy-disable-next-line forward-annotation-syntax-error in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| ruff | F722 |
full |