#!/usr/bin/env python3 """Prevent known large modules from growing while they are incrementally decomposed.""" from pathlib import Path ROOT = Path(__file__).resolve().parents[1] LINE_LIMITS = { "backend/app/services/data_quality.py": 950, "frontend/src/pages/DataQualityIssueDetail.tsx": 850, } BYTE_LIMITS = {"frontend/src/styles.css": 84_000} failures: list[str] = [] for relative, limit in LINE_LIMITS.items(): count = len((ROOT / relative).read_text(encoding="utf-8").splitlines()) print(f"{relative}: {count}/{limit} lines") if count > limit: failures.append(relative) for relative, limit in BYTE_LIMITS.items(): count = (ROOT / relative).stat().st_size print(f"{relative}: {count}/{limit} bytes") if count > limit: failures.append(relative) if failures: raise SystemExit("Source budget exceeded; extract a focused module: " + ", ".join(failures))