mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 1387830 - Make ./mach lint able to output available linters. r=ahal
MozReview-Commit-ID: 2hRtfzohwTR --HG-- extra : rebase_source : 18275b1015f19b98461ebb849555a02fed335462
This commit is contained in:
parent
da35d1368a
commit
4a6556fa3c
@ -27,6 +27,12 @@ class MozlintParser(ArgumentParser):
|
||||
'help': "Linters to run, e.g 'eslint'. By default all linters "
|
||||
"are run for all the appropriate files.",
|
||||
}],
|
||||
[['--list'],
|
||||
{'dest': 'list_linters',
|
||||
'default': False,
|
||||
'action': 'store_true',
|
||||
'help': "List all available linters and exit.",
|
||||
}],
|
||||
[['-f', '--format'],
|
||||
{'dest': 'fmt',
|
||||
'default': 'stylish',
|
||||
@ -107,9 +113,15 @@ def find_linters(linters=None):
|
||||
return lints
|
||||
|
||||
|
||||
def run(paths, linters, fmt, outgoing, workdir, **lintargs):
|
||||
def run(paths, linters, fmt, outgoing, workdir, list_linters=None, **lintargs):
|
||||
from mozlint import LintRoller, formatters
|
||||
|
||||
if list_linters:
|
||||
lint_paths = find_linters(linters)
|
||||
print("Available linters: {}".format(
|
||||
[os.path.splitext(os.path.basename(l))[0] for l in lint_paths]
|
||||
))
|
||||
return 0
|
||||
lint = LintRoller(**lintargs)
|
||||
lint.read(find_linters(linters))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user