Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Config Reference

Use this page to see which config file each tool reads and to set up dx.toml, security.toml and license.toml.

All three files live in the workspace root, the directory that holds MODULE.bazel. All three are optional. An unknown key fails the run. Dates are YYYY-MM-DD. In an [[exception]], [[uncovered]] or [[inventory]] entry, every key whose default is none is required.

dx config

Lists the config file each tool reads and the base dx writes for it under .dx/config/.

tools/dx config
tools/dx config hlint
tools/dx config diff hlint
tools/dx config override hlint
tools/dx config --output json
dx config [<tool> | diff <tool> | override <tool>] [--output text|json]

<tool> is a tool id, such as ruff or hlint. A tool’s root file is its config file in the workspace root, such as ruff.toml. The base is the file dx renders for it, such as .dx/config/ruff/base.toml.

Forms

FormWhat it does
dx configPrints one line per tool your workspace uses.
dx config <tool>Prints every file the tool reads, in order: the root file when there is one, then the base. Works for any tool with a base.
dx config diff <tool>Prints a unified diff from the base to the root file. The dx: override of base header line is ignored. Prints nothing when the copy is unchanged.
dx config override <tool>Copies the base to the tool’s root file and adds a dx: override of base <sha> comment on top. <sha> is the git blob sha of the base. This is the only form that writes.

dx config override <tool> refuses when:

  • the tool can extend its base. dx prints the line to add to your root file instead.
  • the root file already exists. Remove it first.

Output

dx config prints one line per tool:

ruff  ruff.toml  extends .dx/config/ruff/base.toml  edited
taplo  -  tier base .dx/config/taplo/base.toml
ColumnMeaning
ToolThe tool id.
Root fileThe root file, or - when the workspace has none.
Relationextends <base>: the root file extends the base. override of <base>: the root file replaces the base. tier base <base>: the tool reads the base itself.
editedShown when the root file starts with a dx: override of base <sha> comment.

With --output json, dx prints command_started, one config_file event per file, then command_finished. Each config_file event has:

FieldMeaning
toolThe tool id.
fileThe file path.
roleroot or base.
baseThe relation, such as extends .dx/config/ruff/base.toml, or tier base.
editedtrue when the root file has the override comment.
patchdx config diff only: the unified diff as one string, empty when unchanged.
  • dx config emits each tool’s root file, or its base when the tool has no root file.
  • dx config <tool> emits every file the tool reads.
  • dx config diff <tool> emits the root file with patch.
  • dx config override <tool> emits the root file it wrote.

A failure emits one error with code config_failed.

Reports: none.

Flags

FlagWhat it does
-o, --output text|jsonChoose the output format. Default text.
--workspace <dir>Run in this workspace.
-q, --quietHide summaries.
-v, --verboseShow more logs.
--color auto|always|neverSet color output.
--build-slots auto|<n>|offSet build slots.
--build-slots-wait <duration>Give up waiting for a build slot after this long. 0 fails at once.
--bazel-startup-option <token>Pass one Bazel startup option. Repeatable.

Scopes: none. dx config takes a tool name, not scopes.

Exit codes

CodeMeaning
0Success.
1A refused override, a missing base file, or a dx.toml dx cannot load.
2Usage error: an unknown tool, diff on a tool with no root file, a missing tool name, or an extra word.
3dx could not run git or read a file.

dx.toml

Picks the tier, the tools of each language family, and what dx leaves out.

With no dx.toml, every family found in the tree runs its curated tools at the strict tier. Set tier = "standard" to opt down. dx writes the .dx/ directory from this file. Never edit .dx/ by hand.

Start the file with the #:schema line below. An editor with a TOML schema plugin then completes every family and tool id. The schema is dx.schema.json.

#:schema https://raw.githubusercontent.com/devhusdk/rules_dx/main/cli/dx_config/schema/dx.schema.json
schema_version = 1
tier = "standard"

[families.rust]
tier = "strict"
lint = ["clippy", "typos"]

[families.go]
disabled = true

[scope]
exclude = ["//third_party/..."]

dx.toml top level

KeyTypeDefaultMeaning
schema_versionintegernoneMust be 1.
tierstring"strict"strict or standard. The tier for every family that does not set its own, and the base for security.toml and license.toml.
skip_toolsarray of strings[]Tool ids dropped from every family, such as ["typos"]. An unknown id fails the run.
familiestableemptyPer-family settings, keyed by family id. An unknown id fails the run.
scopetableemptyWhat dx leaves out.
large_filestableemptyFiles the large-file check skips.
checktableemptyExtra checks for dx check.
affectedtableemptySettings for --affected. See below.
coveragetableemptyCoverage minimums. See below.

dx.toml [families.<id>]

Replaces the curated tools of one family. A capability you leave out keeps the curated tools. The curated tools are listed in Default tools.

KeyTypeDefaultMeaning
tierstringtop-level tierstandard or strict for this family.
lintarray of stringscuratedTool ids that lint the family.
formatarray of stringscuratedTool ids that format the family.
typecheckarray of stringscuratedTool ids that typecheck the family.
auditarray of stringscuratedTool ids that audit the family, for dx security and dx license. Their policy lives in security.toml and license.toml.
disabledbooleanfalseTurns the whole family off.

A plain list replaces the curated tools: lint = ["clippy"]. A list whose entries all start with + or - edits the curated tools instead, so tools added to the curated set later still reach you: lint = ["+yamllint", "-typos"]. Mixing the two forms fails the run. An unknown tool id fails the run.

dx.toml [scope]

KeyTypeDefaultMeaning
excludearray of strings[]Bazel label patterns dx leaves out. A target is one thing Bazel builds, and a label names it, such as //app:server. //third_party/... means every target under third_party/.

dx.toml [large_files]

KeyTypeDefaultMeaning
allowarray of strings[]Paths or dir/ prefixes the large-file check skips. Lock files are always skipped.

dx.toml [check]

KeyTypeDefaultMeaning
commitsstringoff"conventional" makes dx check --affected report each commit subject since the merge base that is not a conventional commit. See Check.

dx.toml [affected]

KeyTypeDefaultMeaning
basestringdetectedThe branch, such as "origin/develop", whose merge base with HEAD --affected diffs from. Left out, dx uses origin/HEAD, else main or master. A base given on the command line overrides it, see Scope defaults.
whole_repo_testsstringoffA test target, such as "//:smoke", that --affected runs instead of every test when the changes select //.... dx test and dx coverage run only it, and dx coverage checks no [coverage] minimum. The test phase of dx check runs only it and the coverage phase is skipped. dx build only analyzes //.... See Scope defaults.

dx.toml [coverage]

dx coverage and the coverage phase of dx check --coverage both apply these minimums. A minimum left out is not checked. See Build, test, and coverage.

KeyTypeDefaultMeaning
minintegeroffWhole percent, 0 to 100, of the eligible lines of the production sources in scope. Below it the run exits 1.
min_changed_linesintegeroffWhole percent, 0 to 100, of the executable lines added since the base --affected uses: --since, else the merge base with --base, [affected] base, or the default branch. Below it the run exits 1. It needs that base in the Git history.

security.toml

Sets the policy for dx security. dx merges this file over a base picked by the tier in dx.toml. The commands are in Audit, Update.

versions uses the version range syntax of the dependency set’s ecosystem.

security.toml top level

KeyTypeDefaultMeaning
schema_versionintegernoneMust be 1.
exceptionarray of tablesnoneAccepted advisories.
uncoveredarray of tablesnoneAccepted dependency sets with no advisory source.
fail_onarray of stringsthe tier’sAdvisory kinds that fail the run: vulnerability, unsound, unmaintained, notice, yanked. Other kinds are reported as info. standard fails on vulnerability and unsound. strict adds unmaintained, notice and yanked. A list set here replaces the tier’s.

security.toml [[exception]]

KeyTypeDefaultMeaning
advisorystringnoneAdvisory id, such as GHSA-aaaa-bbbb-cccc.
packagestringnonePackage the advisory hits.
setstringnoneDependency set that owns the package.
versionsstringnoneAffected version range.
reasonstringnoneWhy you accept the risk.
expiresstringnoneDate the exception ends.

Three set values are not dependency sets:

  • set = "oci" covers a finding from the oci_deploy image scan. package is the image package. versions is * or a range that holds the installed version.
  • set = "trivy_config" covers a trivy_config lint finding. advisory is the trivy ID, such as DS-0002. package is the workspace-relative file, or * for every file. versions must be *. dx lint drops covered findings until expires.
  • set = "trivy_image_config" covers a trivy_image_config lint finding. package is the workspace-relative BUILD.bazel of the image, or *. The other fields work as for trivy_config.

security.toml [[uncovered]]

KeyTypeDefaultMeaning
setstringnoneDependency set with no advisory source.
reasonstringnoneWhy you accept the gap.
expiresstringnoneDate the acceptance ends.

license.toml

Sets the policy for dx license. dx merges this file over a base picked by the tier in dx.toml. The commands are in Audit, Update.

A list you set here replaces the tier’s list. A list you leave out comes from the tier. The strict tier denies what standard only reviews.

license.toml top level

KeyTypeDefaultMeaning
schema_versionintegernoneMust be 1.
policytableemptyLicense tiers.
distributiontableemptyWhich scopes are internal.
exceptionarray of tablesnoneAccepted license findings.
inventoryarray of tablesnoneLicenses you declare by hand.

license.toml [policy]

KeyTypeDefaultMeaning
blockedarray of strings[]License ids that fail every scope.
distributedtableemptyTiers for distributed scopes.
setstable of tablesemptyPer-set tiers, keyed by set name.

license.toml [policy.distributed]

KeyTypeDefaultMeaning
allowarray of strings[]License ids that pass.
reviewarray of strings[]License ids that need review.
denyarray of strings[]License ids that fail.

license.toml [policy.sets.<set>]

KeyTypeDefaultMeaning
reviewarray of strings[]Extra ids that need review in this set.

license.toml [distribution]

KeyTypeDefaultMeaning
internalarray of strings[]Label patterns for internal scopes.

license.toml [[exception]]

KeyTypeDefaultMeaning
packagestringnonePackage the finding names.
setstringnoneDependency set that owns the package.
licensestringnoneExact license string of the finding.
versionsstringnoneAffected version range.
reasonstringnoneWhy you accept the license.
expiresstringnoneDate the exception ends.

license.toml [[inventory]]

KeyTypeDefaultMeaning
packagestringnonePackage the entry covers.
setstringnoneDependency set that owns the package.
licensestringnoneLicense id of the package.
versionsstringnoneVersion range the entry covers.
text_presentbooleanfalseThe license text ships with the package.
textstringnoneWorkspace-relative path of a vendored license file. Implies text_present. The release NOTICE uses this file for cargo crates that ship no license text.