84fd9ac90e
AST-based static analyzer that identifies type signatures that reduce code clarity and AI-readability. Targets: - Dict[str, Any] / dict[str, Any] (302 findings) - list[dict[...]] (115 findings) - Optional[dict[...]] / Optional[tuple[...]] (11 findings) - Tuple[...]/tuple[...] as anonymous structs (4 findings) - Return tuples and assign tuples (4 findings) The script also counts POSITIVE patterns (TypeAlias, NamedTuple, @dataclass, pydantic.BaseModel) that already exist in the codebase. Current count: 0. The codebase has zero strong type aliases. Usage: python scripts/audit_weak_types.py [--json] [--top N] [--verbose] Exits 0 (informational); exits 1 only on usage error. Initial run on src/ found 430 weak sites across 29 files. The 4 most common unique type strings (list[dict[str, Any]], dict[str, Any], Dict[str, Any], List[Dict[str, Any]]) account for 86% of findings. A focused track adding 4-6 type aliases would eliminate the vast majority of the noise. Output modes: - human-readable (default): top N files with category breakdowns - JSON (--json): machine-readable for tooling - verbose (--verbose): every finding inline Exit codes: - 0: audit ran successfully (regardless of findings) - 1: usage error (bad args, source dir not found)