-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't workinghelp wantedContributions especially welcomeContributions especially welcome
Description
I've searched for RET504 before opening the issue.
def outer() -> list[object]:
@register
async def inner() -> None:
print(layout)
layout = [...]
return layout # noqa: RET504The rule reports the assignment to layout as unnecessary, and provides a fix by rewriting it as return [...], which will break the inner function.
The rule doesn't trigger when layout is assigned to above the definition of the inner function, however in my use-case a decorator replaces the function with an object, which is then used to define layout, mandating the assignment to layout happens below the function definition.
[tool.ruff.lint]
preview = true
explicit-preview-rules = true
select = [ "ALL" ]VSCode extension (v2024.54.0), ruff==0.7.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedContributions especially welcomeContributions especially welcome