Bug 1288432 - Use new mozlint configuration for wpt and wpt_manifest linters, r?jgraham
MozReview-Commit-ID: FQeOf5MBoSF
new file mode 100644
--- /dev/null
+++ b/tools/lint/wpt.yml
@@ -0,0 +1,7 @@
+wpt:
+ description: web-platform-tests lint
+ include:
+ - testing/web-platform/tests
+ exclude: []
+ type: external
+ payload: wpt.wpt:lint
rename from tools/lint/wpt.lint.py
rename to tools/lint/wpt/wpt.py
--- a/tools/lint/wpt.lint.py
+++ b/tools/lint/wpt/wpt.py
@@ -6,50 +6,33 @@
import json
import os
from mozprocess import ProcessHandler
from mozlint import result
-top_src_dir = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)
-tests_dir = os.path.join(top_src_dir, "testing", "web-platform", "tests")
-
results = []
-def process_line(line):
- try:
- data = json.loads(line)
- except ValueError:
- return
- data["level"] = "error"
- data["path"] = os.path.relpath(os.path.join(tests_dir, data["path"]), top_src_dir)
- results.append(result.from_linter(LINTER, **data))
+def lint(files, config, **kwargs):
+ tests_dir = os.path.join(kwargs['root'], 'testing', 'web-platform', 'tests')
+ def process_line(line):
+ try:
+ data = json.loads(line)
+ except ValueError:
+ return
+ data["level"] = "error"
+ data["path"] = os.path.relpath(os.path.join(tests_dir, data["path"]), kwargs['root'])
+ results.append(result.from_config(config, **data))
-def run_process():
path = os.path.join(tests_dir, "lint")
proc = ProcessHandler([path, "--json"], env=os.environ,
processOutputLine=process_line)
proc.run()
try:
proc.wait()
except KeyboardInterrupt:
proc.kill()
-
-def lint(files, **kwargs):
- run_process()
return results
-
-
-LINTER = {
- 'name': "wpt",
- 'description': "web-platform-tests lint",
- 'include': [
- 'testing/web-platform/tests',
- ],
- 'exclude': [],
- 'type': 'external',
- 'payload': lint,
-}
rename from tools/lint/wpt_manifest.lint.py
rename to tools/lint/wpt/wpt_manifest.py
--- a/tools/lint/wpt_manifest.lint.py
+++ b/tools/lint/wpt/wpt_manifest.py
@@ -3,26 +3,13 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import imp
import os
-def lint(files, logger, **kwargs):
+def lint(files, config, logger, **kwargs):
wpt_dir = os.path.join(kwargs["root"], "testing", "web-platform")
manifestupdate = imp.load_source("manifestupdate",
os.path.join(wpt_dir, "manifestupdate.py"))
manifestupdate.update(logger, wpt_dir, True)
-
-
-LINTER = {
- 'name': "wpt_manifest",
- 'description': "web-platform-tests manifest lint",
- 'include': [
- 'testing/web-platform/tests',
- 'testing/web-platform/mozilla/tests',
- ],
- 'exclude': [],
- 'type': 'structured_log',
- 'payload': lint,
-}
new file mode 100644
--- /dev/null
+++ b/tools/lint/wpt_manifest.yml
@@ -0,0 +1,8 @@
+wpt_manifest:
+ description: web-platform-tests manifest lint
+ include:
+ - testing/web-platform/tests
+ - testing/web-platform/mozilla/tests
+ exclude: []
+ type: structured_log
+ payload: wpt.wpt_manifest:lint