mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-10 10:01:40 +00:00
Improve json_verifier script
This commit is contained in:
@@ -4,16 +4,17 @@ import json
|
||||
if len(sys.argv) <= 1:
|
||||
exit(1)
|
||||
|
||||
files = filter(len, sys.argv[1].split('\n'))
|
||||
msg = []
|
||||
for file in files:
|
||||
status = 0
|
||||
|
||||
for file in sys.argv[1:]:
|
||||
with open(file, encoding="ISO-8859-1") as f:
|
||||
try:
|
||||
json.load(f)
|
||||
except ValueError as exception:
|
||||
msg.append("JSON synxtax error on file: {}".format(file))
|
||||
msg.append(str(exception))
|
||||
if msg:
|
||||
print("\n".join(msg))
|
||||
exit(1)
|
||||
exit(0)
|
||||
print("JSON error in {}".format(file))
|
||||
print(exception)
|
||||
status = 1
|
||||
else:
|
||||
print("Valid {}".format(file))
|
||||
|
||||
exit(status)
|
||||
|
||||
@@ -6,6 +6,6 @@ python3 tools/ss13_genchangelog.py html/changelog.html html/changelogs
|
||||
|
||||
find . -name "*.php" -print0 | xargs -0 -n1 php -l
|
||||
|
||||
find . -name "*.json" -not -path "./tgui/node_modules/*" | xargs -0 python3 ./tools/json_verifier.py
|
||||
find . -name "*.json" -not -path "./tgui/node_modules/*" -print0 | xargs -0 python3 ./tools/json_verifier.py
|
||||
|
||||
(cd tgui && source ~/.nvm/nvm.sh && npm ci && node node_modules/gulp/bin/gulp.js --min)
|
||||
|
||||
Reference in New Issue
Block a user