Skip to content

Commit d315d8f

Browse files
blorenteBorja Lorente
andauthored
feat(lint): Add LintInfo providers for linters (#105)
Co-authored-by: Borja Lorente <blorente@apple.com>
1 parent 5abc62b commit d315d8f

File tree

4 files changed

+24
-7
lines changed

4 files changed

+24
-7
lines changed

java/private/checkstyle.bzl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
load(":checkstyle_config.bzl", "CheckStyleInfo")
2+
load("@apple_rules_lint//lint:defs.bzl", "LinterInfo")
23

34
"""
45
Checkstyle rule implementation
@@ -40,6 +41,10 @@ def _checkstyle_impl(ctx):
4041
ctx.attr.config[DefaultInfo].default_runfiles,
4142
),
4243
),
44+
LinterInfo(
45+
language = "java",
46+
name = "checkstyle",
47+
),
4348
]
4449

4550
_checkstyle_test = rule(

java/private/pmd.bzl

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
load(":pmd_ruleset.bzl", "PmdInfo")
2+
load("@apple_rules_lint//lint:defs.bzl", "LinterInfo")
23

34
def _pmd_test_impl(ctx):
45
pmd_info = ctx.attr.ruleset[PmdInfo]
@@ -48,10 +49,16 @@ def _pmd_test_impl(ctx):
4849
transitive_files = transitive_inputs,
4950
)
5051

51-
return DefaultInfo(
52-
executable = out,
53-
runfiles = runfiles.merge(ctx.attr.ruleset[DefaultInfo].default_runfiles),
54-
)
52+
return [
53+
DefaultInfo(
54+
executable = out,
55+
runfiles = runfiles.merge(ctx.attr.ruleset[DefaultInfo].default_runfiles),
56+
),
57+
LinterInfo(
58+
language = "java",
59+
name = "pmd",
60+
),
61+
]
5562

5663
pmd_test = rule(
5764
_pmd_test_impl,

java/private/spotbugs.bzl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
load(":spotbugs_config.bzl", "SpotBugsInfo")
2+
load("@apple_rules_lint//lint:defs.bzl", "LinterInfo")
23

34
"""
45
Spotbugs integration logic
@@ -68,6 +69,10 @@ def _spotbugs_impl(ctx):
6869
executable = out,
6970
runfiles = runfiles,
7071
),
72+
LinterInfo(
73+
language = "java",
74+
name = "spotbugs",
75+
),
7176
]
7277

7378
spotbugs_test = rule(

repositories.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ def contrib_rules_jvm_deps():
66
maybe(
77
http_archive,
88
name = "apple_rules_lint",
9-
sha256 = "8feab4b08a958b10cb2abb7f516652cd770b582b36af6477884b3bba1f2f0726",
10-
strip_prefix = "apple_rules_lint-0.1.1",
11-
url = "https://github.com/apple/apple_rules_lint/archive/0.1.1.zip",
9+
sha256 = "119ecfbecc1befa66d1787b33f39c1250023f5546c73915b2181913628edf21b",
10+
strip_prefix = "apple_rules_lint-0.3.1",
11+
url = "https://github.com/apple/apple_rules_lint/archive/refs/tags/0.3.1.tar.gz",
1212
)
1313
maybe(
1414
http_archive,

0 commit comments

Comments
 (0)