no-hasattr
Do not probe attributes with the builtin hasattr.
Why
In strictly typed code, hasattr hides whether an attribute can be missing at all: it silences the type checker instead of fixing a loose type, so a renamed field quietly takes the fallback branch.
Fix
Narrow the value with isinstance, a Protocol, or a typed wrapper around the untyped library; keep a reasoned SARJ suppression only for genuine runtime feature detection.
Examples
def model_name(settings: object) -> str: return settings.model if hasattr(settings, "model") else "default"from dataclasses import dataclass
@dataclassclass LLMSettings: model: str
def model_name(settings: LLMSettings) -> str: return settings.model