diff options
author | Ravi Shankar <wafflespeanut@gmail.com> | 2016-11-10 19:41:39 +0530 |
---|---|---|
committer | Ravi Shankar <wafflespeanut@gmail.com> | 2016-11-11 19:54:32 +0530 |
commit | 8385c9ae79af76e636cb6bac2366b8fea6c83a9d (patch) | |
tree | 4035130132ff2ca43c8bbaf728f619626dc9db53 /python/servo/lints/wpt_lint.py | |
parent | b5cff9db8fd2a901483cd77ec75f09f5b10eca44 (diff) | |
download | servo-8385c9ae79af76e636cb6bac2366b8fea6c83a9d.tar.gz servo-8385c9ae79af76e636cb6bac2366b8fea6c83a9d.zip |
Isolate the WPT lint and make use of the LintRunner
Diffstat (limited to 'python/servo/lints/wpt_lint.py')
-rw-r--r-- | python/servo/lints/wpt_lint.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/python/servo/lints/wpt_lint.py b/python/servo/lints/wpt_lint.py new file mode 100644 index 00000000000..0fab47c7c35 --- /dev/null +++ b/python/servo/lints/wpt_lint.py @@ -0,0 +1,37 @@ +# Copyright 2013 The Servo Project Developers. See the COPYRIGHT +# file at the top-level directory of this distribution. +# +# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +import os +import site + +from servo_tidy.tidy import LintRunner, filter_file + +WPT_PATH = os.path.join(".", "tests", "wpt") +SUITES = ["web-platform-tests", os.path.join("mozilla", "tests")] + + +class Lint(LintRunner): + def _get_wpt_files(self, suite): + working_dir = os.path.join(WPT_PATH, suite, '') + file_iter = self.get_files(working_dir, exclude_dirs=[]) + print '\nRunning the WPT lint on %s...' % working_dir + for f in file_iter: + if filter_file(f): + yield f[len(working_dir):] + + def run(self): + wpt_working_dir = os.path.abspath(os.path.join(WPT_PATH, "web-platform-tests")) + for suite in SUITES: + files = self._get_wpt_files(suite) + site.addsitedir(wpt_working_dir) + from tools.lint import lint + file_dir = os.path.abspath(os.path.join(WPT_PATH, suite)) + returncode = lint.lint(file_dir, files, output_json=False) + if returncode: + yield ("WPT Lint Tool", "", "lint error(s) in Web Platform Tests: exit status %s" % returncode) |