matrix-builder / scripts /check_python_style.py
ruslanmv
Deploy: metrics + docs (Batch 12)
22b729d
Raw
History Blame Contribute Delete
654 Bytes
from __future__ import annotations
from pathlib import Path
paths = [Path("services/api"), Path("workers"), Path("scripts"), Path("tests")]
violations: list[str] = []
for root in paths:
for path in root.rglob("*.py"):
text = path.read_text(encoding="utf-8")
if "\t" in text:
violations.append(f"{path}: contains tab")
for i, line in enumerate(text.splitlines(), start=1):
if line.rstrip() != line:
violations.append(f"{path}:{i}: trailing whitespace")
if violations:
raise SystemExit("Python style violations:\n" + "\n".join(violations[:50]))
print("Python style checks passed.")