Bug 1288432 - Use new mozlint configuration for wpt and wpt_manifest linters, r=jgraham
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Fri, 02 Jun 2017 09:48:07 -0400
changeset 413294 0eb21ab64fcd026cc753fc6d9457499fab9045d5
parent 413293 97d503af98d9ac9e6fdba3d8c7f2ffc6c74bac27
child 413295 172f1077e83f5cc475f185836ab0d501e3cafbe9
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgraham
bugs1288432
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1288432 - Use new mozlint configuration for wpt and wpt_manifest linters, r=jgraham MozReview-Commit-ID: FQeOf5MBoSF
tools/lint/wpt.lint.py
tools/lint/wpt.yml
tools/lint/wpt/__init__.py
tools/lint/wpt/wpt.py
tools/lint/wpt/wpt_manifest.py
tools/lint/wpt_manifest.lint.py
tools/lint/wpt_manifest.yml
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
new file mode 100644
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