return-outside-function
What it does
Section titled “What it does”Reports a return that is not inside a function.
Why it matters
Section titled “Why it matters”Python rejects the file with SyntaxError: 'return' outside function.
To fix, remove it, or move the code into a function.
Example
Section titled “Example”return 1
def f():...
... return 2Configuration
Section titled “Configuration”python: lint: rules: return-outside-function: warn # off, warn (default), errorEnabled by the presets: python/ruff.
Suppress one line with sudsy-disable-next-line return-outside-function 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 | F706 |
full |