Bug 1803829 - Run black linter with line length 99. r=aleca
This aligns black with flake8. A mass-reformat will be needed in a follow-up. Differential Revision: https://phabricator.services.mozilla.com/D164733 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
2cd3012cc6
Коммит
c7727718bf
|
@ -12,5 +12,5 @@ black:
|
|||
- 'tools/lint/python/**'
|
||||
type: external
|
||||
payload: commlint:lint_wrapper
|
||||
wraps: python.black:lint
|
||||
wraps: commlint:black_lint
|
||||
setup: python.black:setup
|
||||
|
|
|
@ -8,6 +8,7 @@ from pathlib import Path
|
|||
|
||||
from mozpack import path as mozpath
|
||||
from mozlint.types import supported_types
|
||||
from mozlint.pathutils import expand_exclusions
|
||||
|
||||
COMM_EXCLUSION_FILES = [os.path.join("comm", "tools", "lint", "ThirdPartyPaths.txt")]
|
||||
|
||||
|
@ -60,6 +61,23 @@ def eslint_wrapper(paths, config, **lintargs):
|
|||
return rv
|
||||
|
||||
|
||||
def black_lint(paths, config, fix=None, **lintargs):
|
||||
from python.black import run_black
|
||||
|
||||
files = list(expand_exclusions(paths, config, lintargs["root"]))
|
||||
|
||||
# prepend "--line-length 99" to files, it will be processed as an argument
|
||||
black_args = ["-l", "99"] + files
|
||||
|
||||
return run_black(
|
||||
config,
|
||||
black_args,
|
||||
fix=fix,
|
||||
log=lintargs["log"],
|
||||
virtualenv_bin_path=lintargs.get("virtualenv_bin_path"),
|
||||
)
|
||||
|
||||
|
||||
def lint_wrapper(paths, config, **lintargs):
|
||||
_apply_global_excludes(lintargs["root"], config)
|
||||
_expand_support_files(lintargs["root"], config)
|
||||
|
|
Загрузка…
Ссылка в новой задаче