Bazel rules that run VSG (VHDL Style Guide)
against vhdl_library targets.
vsg_test — Bazel test rule that lints a vhdl_library and fails on violations.@rules_vsg//vsg:fix — bazel run-able binary that discovers vhdl_* targets under a
query scope and applies vsg --fix in place to their sources.vsg_aspect — aspect that runs VSG as a side effect of bazel build, opt-in via .bazelrc.Full documentation, setup instructions, and rule reference: https://hw-bzl.github.io/rules_vsg/.
load("@rules_vhdl//vhdl:defs.bzl", "vhdl_library")
load("@rules_vsg//vsg:defs.bzl", "vsg_test")
vhdl_library(
name = "math_pkg",
srcs = ["math_pkg.vhd", "adder.vhd"],
)
vsg_test(
name = "math_pkg_vsg_test",
target = ":math_pkg",
config = ":vsg_config.yaml",
)
Then:
bazel test //:math_pkg_vsg_test — fails on violationsbazel run @rules_vsg//vsg:fix -- //:math_pkg — applies vsg --fix to the workspace filesbazel run @rules_vsg//vsg:fix — same, but across every vhdl_* target in the workspacerules_vsg ships with no registered toolchain — you supply vsg as a Python library and
register a vsg_toolchain. See the documentation for the
full wiring.