From 2eb268f7a548d6a2df9c8fd8cf1c74f684f3caef Mon Sep 17 00:00:00 2001 From: Simon McVittie <simon.mcvittie@collabora.co.uk> Date: Thu, 3 Mar 2016 18:53:47 +0000 Subject: [PATCH] syntax-check: stop parsing .json files These are ostensibly JSON, but what they actually are is Jinja templates whose *output* is JSON. In particular, they can contain {# comments in this syntax #}, causing syntax-check to fail. lqa will check that their output is valid JSON anyway, so I think the ability to have comments is worth more than the syntax check. Reviewed-by: Luis Araujo <luis.araujo@collabora.co.uk> Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Differential Revision: https://phabricator.apertis.org/D2156 --- misc/syntax-check.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/misc/syntax-check.py b/misc/syntax-check.py index ac9c802a..0695cce9 100755 --- a/misc/syntax-check.py +++ b/misc/syntax-check.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """ -Exit nonzero if any .json or .yaml file in the source tree is +Exit nonzero if any .yaml file in the source tree is syntactically invalid. This is run by `make check`. """ @@ -14,13 +14,10 @@ syntactically invalid. This is run by `make check`. # file, You can obtain one at http://mozilla.org/MPL/2.0/. import os -import json import yaml for (dirpath, dirnames, filenames) in os.walk('.'): for basename in filenames: - if basename.endswith('.json'): - json.load(open(os.path.join(dirpath, basename))) - elif basename.endswith('.yaml'): + if basename.endswith('.yaml'): yaml.safe_load(open(os.path.join(dirpath, basename))) -- GitLab