no-nonlocal-statement
Reject nonlocal statements; pass state explicitly or give it a typed owner.
Why
Rebinding an enclosing function's variables hides state changes across callable boundaries. An explicit return value or typed state owner makes that dependency visible.
Fix
Return the updated value and assign it in the caller, or move callback state onto a typed owner. Do not just delete the declaration: that changes Python's name binding and can break the callable.
Examples
def increment(value: int) -> int: def update() -> None: nonlocal value value += 1
update() return valuedef increment(value: int) -> int: def update(current: int) -> int: return current + 1
return update(value)