no-positional-tuple-record
Fixed tuple return records should use named fields instead of positional slots.
Why
A fixed tuple return makes callers remember positions and lets adjacent values be silently swapped. Named records preserve field meaning across public, private, decorated, method, and test boundaries.
Fix
Return a frozen dataclass or validation model. Use typing.NamedTuple only when an exact tuple protocol is required.
Examples
def load_profile() -> tuple[str, int, bool]: return "Ada", 42, Truefrom typing import NamedTuple
class Profile(NamedTuple): name: str age: int active: bool
def load_profile() -> Profile: return Profile(name="Ada", age=42, active=True)Formerly: prefer-namedtuple-over-tuple-return