generated from bazel-contrib/rules-template
-
-
Notifications
You must be signed in to change notification settings - Fork 45
/
linters.bzl
112 lines (91 loc) · 3.28 KB
/
linters.bzl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
"Define linter aspects"
load("@aspect_rules_lint//lint:buf.bzl", "lint_buf_aspect")
load("@aspect_rules_lint//lint:checkstyle.bzl", "lint_checkstyle_aspect")
load("@aspect_rules_lint//lint:clang_tidy.bzl", "lint_clang_tidy_aspect")
load("@aspect_rules_lint//lint:eslint.bzl", "lint_eslint_aspect")
load("@aspect_rules_lint//lint:flake8.bzl", "lint_flake8_aspect")
load("@aspect_rules_lint//lint:ktlint.bzl", "lint_ktlint_aspect")
load("@aspect_rules_lint//lint:lint_test.bzl", "lint_test")
load("@aspect_rules_lint//lint:pmd.bzl", "lint_pmd_aspect")
load("@aspect_rules_lint//lint:ruff.bzl", "lint_ruff_aspect")
load("@aspect_rules_lint//lint:shellcheck.bzl", "lint_shellcheck_aspect")
load("@aspect_rules_lint//lint:stylelint.bzl", "lint_stylelint_aspect")
load("@aspect_rules_lint//lint:vale.bzl", "lint_vale_aspect")
buf = lint_buf_aspect(
config = "@@//:buf.yaml",
)
eslint = lint_eslint_aspect(
binary = "@@//tools/lint:eslint",
# ESLint will resolve the configuration file by looking in the working directory first.
# See https://eslint.org/docs/latest/use/configure/configuration-files#configuration-file-resolution
# We must also include any other config files we expect eslint to be able to locate, e.g. tsconfigs
configs = [
"@@//:eslintrc",
"@@//src:tsconfig",
],
)
eslint_test = lint_test(aspect = eslint)
stylelint = lint_stylelint_aspect(
binary = "@@//tools/lint:stylelint",
config = "@@//:stylelintrc",
)
flake8 = lint_flake8_aspect(
binary = "@@//tools/lint:flake8",
config = "@@//:.flake8",
)
flake8_test = lint_test(aspect = flake8)
pmd = lint_pmd_aspect(
binary = "@@//tools/lint:pmd",
rulesets = ["@@//:pmd.xml"],
)
pmd_test = lint_test(aspect = pmd)
checkstyle = lint_checkstyle_aspect(
binary = "@@//tools/lint:checkstyle",
config = "@@//:checkstyle.xml",
data = ["@@//:checkstyle-suppressions.xml"],
)
checkstyle_test = lint_test(aspect = checkstyle)
ruff = lint_ruff_aspect(
binary = "@multitool//tools/ruff",
configs = [
"@@//:.ruff.toml",
"@@//src/subdir:ruff.toml",
],
)
ruff_test = lint_test(aspect = ruff)
shellcheck = lint_shellcheck_aspect(
binary = "@multitool//tools/shellcheck",
config = "@@//:.shellcheckrc",
)
shellcheck_test = lint_test(aspect = shellcheck)
vale = lint_vale_aspect(
binary = "@@//tools/lint:vale",
config = "@@//:.vale.ini",
styles = "@@//tools/lint:vale_styles",
)
ktlint = lint_ktlint_aspect(
binary = "@@com_github_pinterest_ktlint//file",
editorconfig = "@@//:.editorconfig",
baseline_file = "@@//:ktlint-baseline.xml",
)
ktlint_test = lint_test(aspect = ktlint)
clang_tidy = lint_clang_tidy_aspect(
binary = "@@//tools/lint:clang_tidy",
configs = [
"@@//:.clang-tidy",
"@@//src/cpp/lib:get/.clang-tidy",
],
lint_target_headers = True,
angle_includes_are_system = False,
verbose = False,
)
clang_tidy_test = lint_test(aspect = clang_tidy)
# an example of setting up a different clang-tidy aspect with different
# options. This one uses a single global clang-tidy file
clang_tidy_global_config = lint_clang_tidy_aspect(
binary = "@@//tools/lint:clang_tidy",
global_config = "@@//:.clang-tidy",
lint_target_headers = True,
angle_includes_are_system = False,
verbose = False,
)