tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 6525de06cbc84741c84c55dd9978757fa41069c6
parent 0c134a0726f9c2658398ba0c020a64997b4f57d7
Author: Beatriz Rizental <bea@torproject.org>
Date:   Wed, 31 Jul 2024 16:24:41 +0200

BB 42728: Modify ./mach lint to skip unused linters

Diffstat:
Mpython/mozlint/mozlint/cli.py | 41+++++++++++++++++++++++++++++++++++++++--
1 file changed, 39 insertions(+), 2 deletions(-)

diff --git a/python/mozlint/mozlint/cli.py b/python/mozlint/mozlint/cli.py @@ -12,6 +12,36 @@ from pathlib import Path from mozlint.errors import NoValidLinter from mozlint.formatters import all_formatters +# We (the Tor Project) do not use all of Mozilla's linters. +# Below is a list of linters we do not use, +# these will be skipped when running `./mach lint` commands. +INACTIVE_LINTERS = [ + "android-ac", + "android-api-lint", + "android-checkstyle", + "android-fenix", + "android-focus", + "android-format", + "android-javadoc", + "android-lint", + "android-test", + "clippy", + "codespell", + "condprof-addons", + "file-perm", + "ignorefile", + "license", + "lintpref", + "perfdocs", + "rejected-words", + "rst", + "updatebot", + "typescript", + "wpt", + "stylelint", + "glean-parser", +] + class MozlintParser(ArgumentParser): arguments = [ @@ -318,6 +348,9 @@ def find_linters(config_paths, linters=None): name = name.rsplit(".", 1)[0] + if not linters and name in INACTIVE_LINTERS: + continue + if linters and name not in linters: continue @@ -384,10 +417,14 @@ def run( if list_linters: lint_paths = find_linters(lintargs["config_paths"], linters) - linters = [ + formatted_linters = [ os.path.splitext(os.path.basename(l))[0] for l in lint_paths["lint_paths"] ] - print("\n".join(sorted(linters))) + print("\n".join(sorted(formatted_linters))) + + if not linters: + print("\nINACTIVE -- ".join(sorted(["", *INACTIVE_LINTERS])).strip()) + print( "\nNote that clang-tidy checks are not run as part of this " "command, but using the static-analysis command."