Commit ae0bb480 authored by brizental's avatar brizental Committed by Pier Angelo Vendrame
Browse files

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

parent 558b7894
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -274,7 +274,7 @@ module.exports = {
    // Remove this line setting `csscontrols/use-logical` to null after implementing fixes
    "csstools/use-logical": null,
    "stylelint-plugin-mozilla/no-base-design-tokens": true,
    "stylelint-plugin-mozilla/use-design-tokens": true,
    "stylelint-plugin-mozilla/use-design-tokens": false,
  },

  overrides: [
+38 −2
Original line number Diff line number Diff line
@@ -12,6 +12,35 @@ 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",
    "glean-parser",
]


class MozlintParser(ArgumentParser):
    arguments = [
@@ -322,6 +351,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

@@ -388,10 +420,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."