зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1288432 - Use new mozlint configuration for wpt and wpt_manifest linters, r=jgraham
MozReview-Commit-ID: FQeOf5MBoSF --HG-- rename : tools/lint/wpt.lint.py => tools/lint/wpt/wpt.py rename : tools/lint/wpt_manifest.lint.py => tools/lint/wpt/wpt_manifest.py extra : rebase_source : cc6867cad7325d1557787d826006c4a921c1ac42
This commit is contained in:
Родитель
958af4447e
Коммит
c52fd7290e
|
@ -1,55 +0,0 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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 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 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,
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
wpt:
|
||||
description: web-platform-tests lint
|
||||
include:
|
||||
- testing/web-platform/tests
|
||||
exclude: []
|
||||
type: external
|
||||
payload: wpt.wpt:lint
|
|
@ -0,0 +1,38 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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 json
|
||||
import os
|
||||
|
||||
from mozprocess import ProcessHandler
|
||||
|
||||
from mozlint import result
|
||||
|
||||
results = []
|
||||
|
||||
|
||||
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))
|
||||
|
||||
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()
|
||||
|
||||
return results
|
|
@ -8,21 +8,8 @@ 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,
|
||||
}
|
|
@ -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
|
Загрузка…
Ссылка в новой задаче