vsg:fix

@rules_vsg//vsg:fix is a bazel run-able binary that discovers every vhdl_* target under a query scope, collects its .vhd / .vhdl sources, and applies vsg --fix in place to the workspace tree. It replaces the legacy per-target vsg_fixer rule — one binary handles the whole workspace, so no companion target is needed for each vhdl_library.

Usage

# Fix everything in the current workspace
bazel run @rules_vsg//vsg:fix

# Fix a single package or target
bazel run @rules_vsg//vsg:fix -- //some/pkg:all
bazel run @rules_vsg//vsg:fix -- //some/pkg:my_lib

# Forward extra arguments to vsg (anything after `--` after the scope)
bazel run @rules_vsg//vsg:fix -- //some/pkg:all -- --junit /tmp/vsg.xml

scope accepts any bazel query-compatible label pattern. If omitted it defaults to //...:all — the entire workspace.

Configuration

The fixer uses the //vsg:config label_flag as its VSG configuration file (identical to vsg_test and vsg_aspect). Override it per-invocation with:

bazel run --@rules_vsg//vsg:config=//path/to:vsg.yaml @rules_vsg//vsg:fix

Extra vsg arguments

The fixer accepts extra vsg arguments only via the CLI passthrough — anything after a second -- is forwarded verbatim to vsg:

bazel run @rules_vsg//vsg:fix -- //some/pkg:all -- -of=summary -b

The fixer defaults to --output_format=syntastic; passing -of=<other> overrides it.

The //vsg:extra_args build flag exists for vsg_test and vsg_aspect — it does not affect the fixer. Fixer runs are already interactive (bazel run under a user's shell), so per-invocation CLI args are the natural surface. Common vsg flags worth knowing:

  • -of=summary — one line per file.
  • -of=vsg — vsg's verbose default.
  • -b — write <file>.vsg.bak alongside each fixed source.
  • -fp=<N> — apply fixes only up to phase N.

Ignore tags

Targets tagged with any of the following are skipped by the fixer (matching vsg_aspect's behavior):

  • no_vsg / novsg
  • no_lint / nolint
  • no_format / noformat

Tag comparison is case-insensitive and treats - and _ as equivalent.

External sources

Sources from external repositories (@repo//...) are never fixed — the fixer only mutates files inside the calling workspace.