Skip to content

Configuration

Set a project policy once in rust-doctor.toml.

#Priority

Highest first:

  1. --rule on the command line
  2. --category on the command line
  3. [rules] in rust-doctor.toml
  4. [categories] in rust-doctor.toml
  5. The level the catalog ships for that rule

#rust-doctor.toml

The file lives at the root of the workspace being scanned. Every key is optional, and an unknown key is an error rather than something quietly ignored: a policy you thought you set and did not is worse than a refusal.

# Severity at which the process exits non-zero: none, error, or warning.
blocking = "error"

# Levels are off, warn, or error.
[categories]
security = "error"
maintainability = "off"

# A rule override wins over its category.
[rules]
"clippy::unwrap_used" = "error"
"rust_doctor::structure::near_duplicate" = "off"

# Thresholds the complexity detector reads. A key left out keeps its default;
# zero is refused, since it would report every function.
[structure]
cyclomatic-threshold = 15
cognitive-threshold = 20

Rule identifiers carry the producer that emits them: clippy::* for the 37 curated lints, and rust_doctor::source::*, rust_doctor::cargo::*, rust_doctor::structure::*, rust_doctor::repo::* for the native detectors. An identifier that no rule answers to is refused when the file is read, not silently dropped.

The file is read up to 64 KB. A rust-doctor.toml that is unreadable, too large, invalid UTF-8, or not a regular file fails the configuration stage rather than being skipped.

#Turning a rule off

off removes the rule from the scan, so it stops costing the score and stops appearing in the report. For a Clippy rule this drops its -W flag, which is why no catalogued Clippy rule is deny by default: a deny lint cannot be switched off without turning the scan into a compilation failure.