Bazel rules that run VSG (VHDL Style Guide)
against vhdl_library targets.
vsg_test— Bazel test rule that lints avhdl_libraryand fails on violations.vsg_fixer—bazel run-able target that appliesvsg --fixin place to the workspace sources.vsg_aspect— aspect that runs VSG as a side effect ofbazel 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_fixer", "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",
)
vsg_fixer(
name = "math_pkg_vsg_fix",
target = ":math_pkg",
config = ":vsg_config.yaml",
)Then:
bazel test //:math_pkg_vsg_test— fails on violationsbazel run //:math_pkg_vsg_fix— appliesvsg --fixto the workspace files
rules_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.