prefer-non-nullable-collection
Avoid nullable list parameters that are immediately collapsed to an empty list.
Why
When an implementation immediately replaces both None and an empty list with the same fresh empty list, the callable contract exposes an extra input state that its body does not retain.
Fix
After reviewing callers and list identity or mutation behavior, either require the list or accept Sequence[T] = () and materialize a list internally. Removing explicit None acceptance is an API migration.
Examples
def resolve(candidates: list[str] | None = None) -> list[str]: return candidates or []from collections.abc import Sequence
def resolve(candidates: Sequence[str] = ()) -> list[str]: return list(candidates)