mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +02:00
Reorganized layout of CI directory, move all before_install files into
common directory, remove copy-pasted files
This commit is contained in:
28
CI/validate_json.py
Executable file
28
CI/validate_json.py
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from pprint import pprint
|
||||
|
||||
# VCMI supports JSON with comments, but not JSON5
|
||||
import jstyleson
|
||||
|
||||
validation_failed = False
|
||||
|
||||
for path in sorted(Path(".").glob("**/*.json"), key=lambda path: str(path).lower()):
|
||||
# because path is an object and not a string
|
||||
path_str = str(path)
|
||||
if path_str.startswith("."):
|
||||
continue
|
||||
|
||||
try:
|
||||
with open(path_str, "r") as file:
|
||||
jstyleson.load(file)
|
||||
print(f"✅ {path_str}")
|
||||
except Exception as exc:
|
||||
print(f"❌ {path_str}: {exc}")
|
||||
validation_failed = True
|
||||
|
||||
if validation_failed:
|
||||
sys.exit(1)
|
||||
Reference in New Issue
Block a user