Skip to content

X0031 taplo-fmt

Rule: Every TOML file parses and is formatted as taplo writes it.

Code X0031 (stable, never reused)
Id taplo-fmt
Category taplo
Source taplo (run as an executable)
Fix exact: spl check --fix applies it
Needs taplo installed

Level per tier

Tier Level Reason
small off
small-workspace warn manifests are edited by people and by tools; one TOML formatting keeps their diffs about the change
medium warn manifests are edited by people and by tools; one TOML formatting keeps their diffs about the change
big deny manifests are edited by people and by tools; one TOML formatting keeps their diffs about the change
ai off
embedded off
ui off
egui off
units-strict off
units-paranoid off

Why

Manifests and configuration files are edited by people and by tools (cargo add, cargo hakari); one formatting keeps their diffs about the change. taplo formats TOML by the project's taplo.toml (or its defaults) and reports files that do not parse.

# taplo.toml
[formatting]
align_entries = false
column_width = 120

How to fix

spl check --fix writes each file as taplo fmt formats it. A file that does not parse is fixed by hand at the place reported.

Configure

[lints.taplo-fmt]
level = "deny"
reason = "why this project wants it at this level"

Allow one finding in the code with // spirit-level: allow(taplo-fmt) <reason> (waivers); the code works there too, as in [lints.X0031].