You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: detekt/defs.bzl
+87-27Lines changed: 87 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,22 @@ Rule declarations.
4
4
5
5
load("@rules_java//java:defs.bzl", "JavaInfo")
6
6
7
+
_SHARED_ATTRS= [
8
+
"build_upon_default_config",
9
+
"cfgs",
10
+
"disable_default_rulesets",
11
+
"fail_on_severity",
12
+
"jvm_target",
13
+
"language_version",
14
+
"max_issues",
15
+
"parallel",
16
+
"plugins",
17
+
]
18
+
7
19
_ATTRS= {
20
+
"detekt_explicit_attrs": attr.string_list(
21
+
default= [],
22
+
),
8
23
"_result_script_template": attr.label(
9
24
default=Label("//detekt:result_script.sh.tpl"),
10
25
allow_single_file=True,
@@ -18,12 +33,12 @@ _ATTRS = {
18
33
"plugins": attr.label_list(
19
34
default= [],
20
35
providers= [JavaInfo],
21
-
doc="Extra paths to plugin jars.",
36
+
doc="Extra paths to plugin jars. If omitted, inherits from the detekt toolchain; an explicit empty list clears toolchain plugins.",
22
37
),
23
38
"cfgs": attr.label_list(
24
39
default= [],
25
40
allow_files= [".yml"],
26
-
doc="Path to the config file (path/to/config.yml). Multiple configuration files can be specified.",
41
+
doc="Path to the config file (path/to/config.yml). Multiple configuration files can be specified. If omitted, inherits from the detekt toolchain; an explicit empty list clears toolchain configs.",
27
42
),
28
43
"config_resource": attr.string(
29
44
default="",
@@ -48,11 +63,11 @@ _ATTRS = {
48
63
),
49
64
"build_upon_default_config": attr.bool(
50
65
default=False,
51
-
doc="Preconfigures detekt with a bunch of rules and some opinionated defaults for you. Allows additional provided configurations to override the defaults.",
66
+
doc="Preconfigures detekt with a bunch of rules and some opinionated defaults for you. If omitted, inherits from the detekt toolchain; explicit False clears the toolchain value.",
52
67
),
53
68
"disable_default_rulesets": attr.bool(
54
69
default=False,
55
-
doc="Disables default rule sets.",
70
+
doc="Disables default rule sets. If omitted, inherits from the detekt toolchain; explicit False clears the toolchain value.",
56
71
),
57
72
"excludes": attr.string_list(
58
73
default= [],
@@ -64,35 +79,35 @@ _ATTRS = {
64
79
),
65
80
"jvm_target": attr.string(
66
81
default="",
67
-
doc="EXPERIMENTAL: Target version of the generated JVM bytecode that was generated during compilation and is now being used for type resolution (1.8, 9, 10, ..., 26). The selected Detekt version validates this value.",
82
+
doc="EXPERIMENTAL: Target version of the generated JVM bytecode that was generated during compilation and is now being used for type resolution (1.8, 9, 10, ..., 26). If omitted, inherits from the detekt toolchain; explicit values, including empty string, replace it. The selected Detekt version validates this value.",
68
83
),
69
84
"language_version": attr.string(
70
85
default="",
71
-
doc="EXPERIMENTAL: Compatibility mode for Kotlin language version X.Y, reports errors for all language features that came out later. The selected Detekt version validates this value.",
86
+
doc="EXPERIMENTAL: Compatibility mode for Kotlin language version X.Y, reports errors for all language features that came out later. If omitted, inherits from the detekt toolchain; explicit values, including empty string, replace it. The selected Detekt version validates this value.",
72
87
),
73
88
"max_issues": attr.int(
74
89
default=-1,
75
-
doc="Passes only when found issues count does not exceed specified issues count. Negative values inherit from the detekt toolchain.",
90
+
doc="Detekt 1.x failure threshold: passes only when the found issue count does not exceed this value. If omitted, inherits from the detekt toolchain; explicit -1 clears it. Mutually exclusive with fail_on_severity.",
76
91
),
77
92
"fail_on_severity": attr.string(
78
93
default="",
79
-
doc="Detekt 2.x failure threshold (Error, Warning, Info, or Never). Mutually exclusive with max_issues.",
94
+
doc="Detekt 2.x failure threshold (Error, Warning, Info, or Never). If omitted, inherits from the detekt toolchain; explicit empty string clears it. Mutually exclusive with max_issues.",
80
95
),
81
96
"parallel": attr.bool(
82
97
default=False,
83
-
doc="Enables parallel compilation and analysis of source files. Defaults to the detekt toolchain value.",
98
+
doc="Enables parallel compilation and analysis of source files. If omitted, inherits from the detekt toolchain; explicit False clears the toolchain value.",
84
99
),
85
100
"txt_report": attr.bool(
86
101
default=False,
87
-
doc="Enables / disables the text report generation. The report file name is `{target_name}_detekt_report.txt`.",
102
+
doc="Enables / disables the text report generation. The report file name is `{target_name}_detekt_report.txt`; Detekt 2.x uses captured console output for this artifact.",
88
103
),
89
104
"html_report": attr.bool(
90
105
default=False,
91
106
doc="Enables / disables the HTML report generation. The report file name is `{target_name}_detekt_report.html`.",
92
107
),
93
108
"xml_report": attr.bool(
94
109
default=False,
95
-
doc="Enables / disables the XML report generation. The report file name is `{target_name}_detekt_report.xml`. FYI Detekt uses the Checkstyle XML reporting format which makes it compatible with tools like SonarQube.",
110
+
doc="Enables / disables the XML report generation. The report file name is `{target_name}_detekt_report.xml`. Detekt 2.x maps this output to its `checkstyle` report ID; the format is compatible with tools like SonarQube.",
96
111
),
97
112
"md_report": attr.bool(
98
113
default=False,
@@ -111,19 +126,36 @@ _ATTRS = {
111
126
doc="Whether detekt target corresponds to android kotlin library or regular jvm library",
112
127
default=False,
113
128
),
129
+
"detekt_toolchain": attr.label(
130
+
default=None,
131
+
cfg="exec",
132
+
providers= [platform_common.ToolchainInfo],
133
+
doc="Optional label of a target providing platform_common.ToolchainInfo. If omitted, uses the registered detekt toolchain.",
134
+
),
114
135
}
115
136
137
+
# Stardoc can consume this schema without exposing the implementation rules.
0 commit comments