Configure
Configuration is one optional file, tx0.toml, at the root of the tree. Without it, the default tier runs and any finding fails the gate.
tx0.toml
The file sets the tier, excluded paths, levels per rule or pack, overrides for some paths, and the gate that decides when tx0 check fails. tx0 init writes a commented one.
tier = "recommended" # default, recommended, strict or all
exclude = ["vendor/**"]
[rules]
"tx0/go:*" = "warning"
"tx0/go:unreachable-code" = "error"
[[overrides]]
paths = ["**/*_test.go"]
rules = { "tx0/go:identical-operands" = "off" }
[gate] # at most this many reported findings
errors = 0
warnings = 20Tiers
Each tier includes the ones before it. Any rule can also be turned on by its id under [rules].
| Tier | Rules | What it adds |
|---|---|---|
default | 353 | Bugs and security problems with measured precision |
recommended | +401 | Likely bugs, resource and performance problems |
strict | +426 | Code that can be written more plainly |
all | 1183 | Every rule |
tx0 check --tier T uses another tier for one run.
Rule levels
Levels are off, note, warning and error. A key under [rules] names one rule or, with *, every rule of a pack. An entry in [[overrides]] applies to the paths it lists, such as tests.
The gate
[gate] sets how many reported findings of each level are allowed. tx0 check exits with 1 when the findings it reports exceed it. Without a gate, any finding fails it. Output and exit codes lists every exit code.
Mistakes
A mistake in the file is reported with its line and, for a likely typo, the name that was meant:
$ tx0 check
tx0.toml: unknown tier `recomended`, expected one of default, recommended, strict, all at line 1, column 8; did you mean `recommended`? tx0 explain RULE FILE says why a rule runs on a file or not, taking the file into account.