1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-13 11:40:38 +02:00

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

This commit is contained in:
Alexander Wilms 2024-02-08 22:57:26 +01:00
parent 1fa3447ee7
commit 95b35a1063
2 changed files with 5 additions and 4 deletions

View File

@ -124,7 +124,7 @@ jobs:
# also, running it on multiple presets is redundant and slightly increases already long CI built times
if: ${{ startsWith(matrix.preset, 'linux-clang-test') }}
run: |
pip3 install json5
pip3 install jstyleson
python3 CI/linux-qt6/validate_json.py
- name: Dependencies

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: