32 lines
1.1 KiB
Python
Executable File
32 lines
1.1 KiB
Python
Executable File
#!/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": 900,
|
|
"backend/app/services/data_quality_duplicate_scan.py": 150,
|
|
"frontend/src/pages/DataQualityIssueDetail.tsx": 700,
|
|
"frontend/src/pages/data-quality/DuplicateCustomerPanel.tsx": 250,
|
|
}
|
|
BYTE_LIMITS = {
|
|
"frontend/src/styles.css": 78_000,
|
|
"frontend/src/styles-data-quality.css": 8_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))
|