Skip to content

Commit b7cf648

Browse files
authored
Update shellcheck_aspect to use rules_shell providers (#58)
1 parent b47411a commit b7cf648

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module(
66

77
bazel_dep(name = "bazel_skylib", version = "1.8.2")
88
bazel_dep(name = "platforms", version = "1.0.0")
9-
bazel_dep(name = "rules_shell", version = "0.6.1")
9+
bazel_dep(name = "rules_shell", version = "0.7.1")
1010

1111
shellcheck = use_extension("//shellcheck/internal:extensions.bzl", "shellcheck")
1212
use_repo(

shellcheck/internal/rules.bzl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"""
33

44
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
5+
load("@rules_shell//shell:sh_binary_info.bzl", "ShBinaryInfo")
6+
load("@rules_shell//shell:sh_info.bzl", "ShInfo")
57
load(":toolchain.bzl", "TOOLCHAIN_TYPE")
68

79
_SHELL_CONTENT = """\
@@ -112,12 +114,6 @@ ShellcheckSrcsInfo = provider(
112114
)
113115

114116
def _shellcheck_srcs_aspect_impl(_target, ctx):
115-
# TODO: Replace when a `rules_shell` provider is available
116-
# https://github.com/bazelbuild/rules_shell/issues/16
117-
rule_name = ctx.rule.kind
118-
if rule_name not in ["sh_binary", "sh_test", "sh_library"]:
119-
return []
120-
121117
srcs = getattr(ctx.rule.files, "srcs", [])
122118
source_paths = [src.dirname for src in srcs]
123119

@@ -243,4 +239,5 @@ shellcheck_aspect = aspect(
243239
},
244240
toolchains = [TOOLCHAIN_TYPE],
245241
requires = [_shellcheck_srcs_aspect],
242+
required_providers = [[ShInfo], [ShBinaryInfo]],
246243
)

0 commit comments

Comments
 (0)