From e301ff46b2ab1dc823489fd979e64bc04c931aed Mon Sep 17 00:00:00 2001 From: jmr0 Date: Sun, 29 Nov 2015 20:51:55 -0500 Subject: [PATCH] adding wpt lint script to tidy checks --- python/tidy.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/python/tidy.py b/python/tidy.py index af79f66b3b44..6f8b023f5cb5 100644 --- a/python/tidy.py +++ b/python/tidy.py @@ -544,6 +544,16 @@ def check_reftest_html_files_in_basic_list(reftest_dir): yield (file_path, "", "not found in basic.list") +def check_wpt_lint_errors(): + import subprocess + wpt_working_dir = os.path.abspath(os.path.join(".", "tests", "wpt", "web-platform-tests")) + lint_cmd = os.path.join(wpt_working_dir, "lint") + try: + subprocess.check_call(lint_cmd, cwd=wpt_working_dir) # Must run from wpt's working dir + except subprocess.CalledProcessError as e: + yield ("WPT Lint Tool", "", "lint error(s) in Web Platform Tests: exit status {0}".format(e.returncode)) + + def scan(): all_files = (os.path.join(r, f) for r, _, files in os.walk(".") for f in files) files_to_check = filter(should_check, all_files) @@ -556,9 +566,9 @@ def scan(): reftest_to_check = filter(should_check_reftest, reftest_files) r_errors = check_reftest_order(reftest_to_check) not_found_in_basic_list_errors = check_reftest_html_files_in_basic_list(reftest_dir) + wpt_lint_errors = check_wpt_lint_errors() - errors = list(itertools.chain(errors, r_errors, not_found_in_basic_list_errors)) - + errors = list(itertools.chain(errors, r_errors, not_found_in_basic_list_errors, wpt_lint_errors)) if errors: for error in errors: print "\033[94m{}\033[0m:\033[93m{}\033[0m: \033[91m{}\033[0m".format(*error)