CI: Accept JSON with comments, but not JSON5 in its entirety

This commit is contained in:
Alexander Wilms
2024-02-12 00:49:57 +01:00
parent 1fa3447ee7
commit 95b35a1063
2 changed files with 5 additions and 4 deletions
+4 -3
View File
@@ -5,7 +5,8 @@ import sys
from pathlib import Path
from pprint import pprint
import json5
# VCMI supports JSON with comments, but not JSON5
import jstyleson
validation_failed = False
@@ -17,10 +18,10 @@ for path in sorted(Path(".").glob("**/*.json"), key=lambda path: str(path).lower
try:
with open(path_str, "r") as file:
json5.load(file)
jstyleson.load(file)
print(f"✅ {path_str}")
except Exception as exc:
print(f"❌ {str(exc).replace('<string>', path_str)}")
print(f"❌ {path_str}: {exc}")
validation_failed = True
if validation_failed: