chore(ruff): Enable RET rules and add explicit fallbacks

Adopt Ruff `RET` to improve return-flow consistency across the codebase.
Simplify control flow by removing redundant `else` blocks after
`return`, and add explicit `return None` (or equivalent) fallbacks
where appropriate to preserve existing behavior.

Fixes #21411
This commit is contained in:
Martin Hauser
2026-02-18 22:22:47 +01:00
committed by Jeremy Stretch
parent b22e490847
commit ef52ac4203
77 changed files with 249 additions and 249 deletions

View File

@@ -37,10 +37,12 @@ extend-select = [
"E501", # pycodestyle: line too long (enforced with `line-length` above)
"W", # pycodestyle warnings (various style warnings, often whitespace/newlines)
"I", # import sorting (isort-equivalent)
"RET", # return semantics (flake8-return family)
]
ignore = [
"F403", # pyflakes: `from ... import *` used; unable to detect undefined names
"F405", # pyflakes: name may be undefined or defined from star imports
"RET504", # return: unnecessary assignment before `return` (e.g., `x = expr; return x` -> `return expr`)
"UP032", # pyupgrade: prefer f-strings over `str.format(...)`
]
preview = true