shellcheck
API for declaring a shellcheck lint aspect that visits sh_library rules.
Typical usage:
Use shellcheck_aspect to declare the shellcheck linter aspect, typically in in tools/lint/linters.bzl
:
load("@aspect_rules_lint//lint:shellcheck.bzl", "shellcheck_aspect")
shellcheck = shellcheck_aspect(
binary = "@multitool//tools/shellcheck",
config = "@@//:.shellcheckrc",
)
Macros and Functions
lint_shellcheck_aspect
A factory function to create a linter aspect.
Attrs: binary: a shellcheck executable. config: the .shellcheckrc file
Example usage (generated):
load("@aspect_rules_lint//lint:shellcheck.bzl", "lint_shellcheck_aspect")
lint_shellcheck_aspect(
binary = None,
config = None,
)
binary
Required.
config
Required.
shellcheck_action
Run shellcheck as an action under Bazel.
Based on https://github.com/koalaman/shellcheck/blob/master/shellcheck.1.md
Example usage (generated):
load("@aspect_rules_lint//lint:shellcheck.bzl", "shellcheck_action")
shellcheck_action(
# Bazel Rule or Aspect evaluation context
ctx = None,
# label of the the shellcheck program
executable = None,
# bash files to be linted
srcs = [],
# label of the .shellcheckrc file
config = None,
# output file to generate
output = None,
)
ctx
Required.
Bazel Rule or Aspect evaluation context
executable
Required.
label of the the shellcheck program
srcs
Required.
bash files to be linted
config
Required.
label of the .shellcheckrc file
output
Required.
output file to generate
use_exit_code
Optional. Default: False
whether to fail the build when a lint violation is reported
options
Optional. Default: []
additional command-line options, see https://github.com/koalaman/shellcheck/blob/master/shellcheck.hs#L95