2023-09-16 13:18:09 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2023-09-16 01:52:04 +02:00
|
|
|
import re
|
2023-10-27 15:33:38 +02:00
|
|
|
import sys
|
2023-09-15 22:55:48 +02:00
|
|
|
from pathlib import Path
|
|
|
|
from pprint import pprint
|
2023-09-16 01:52:04 +02:00
|
|
|
|
2023-09-16 01:31:43 +02:00
|
|
|
import json5
|
|
|
|
|
2024-02-08 20:07:15 +02:00
|
|
|
validation_failed = False
|
2023-09-15 22:55:48 +02:00
|
|
|
|
2024-02-08 20:07:15 +02:00
|
|
|
for path in sorted(Path(".").glob("**/*.json"), key=lambda path: str(path).lower()):
|
2023-09-15 22:55:48 +02:00
|
|
|
# because path is an object and not a string
|
|
|
|
path_str = str(path)
|
2024-02-08 20:07:15 +02:00
|
|
|
if path_str.startswith("."):
|
|
|
|
continue
|
|
|
|
|
2023-09-15 22:55:48 +02:00
|
|
|
try:
|
2023-10-27 15:30:35 +02:00
|
|
|
with open(path_str, "r") as file:
|
2024-02-08 20:07:15 +02:00
|
|
|
json5.load(file)
|
|
|
|
print(f"✅ {path_str}")
|
2023-09-15 22:55:48 +02:00
|
|
|
except Exception as exc:
|
2024-02-08 20:07:15 +02:00
|
|
|
print(f"❌ {str(exc).replace('<string>', path_str)}")
|
|
|
|
validation_failed = True
|
2023-09-15 22:55:48 +02:00
|
|
|
|
2024-02-08 20:07:15 +02:00
|
|
|
if validation_failed:
|
2023-10-27 15:33:38 +02:00
|
|
|
sys.exit(1)
|