28 lines
609 B
Python
28 lines
609 B
Python
|
|
#!/usr/bin/env python3
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
import json
|
||
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
ROOT = Path(__file__).resolve().parents[1]
|
||
|
|
|
||
|
|
|
||
|
|
def main() -> int:
|
||
|
|
errors = 0
|
||
|
|
for path in sorted(ROOT.rglob("*.json")):
|
||
|
|
if ".git" in path.parts:
|
||
|
|
continue
|
||
|
|
try:
|
||
|
|
json.loads(path.read_text(encoding="utf-8"))
|
||
|
|
except Exception as exc:
|
||
|
|
print(f"JSON ERROR {path.relative_to(ROOT)}: {exc}")
|
||
|
|
errors += 1
|
||
|
|
if errors:
|
||
|
|
return 1
|
||
|
|
print("OK: all JSON files parse")
|
||
|
|
return 0
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
raise SystemExit(main())
|