Open
Description
Summary
TOML files are currently arbitrarily formatted. This is not good for git diff and specifically for Cargo.toml consistency. For example, a snippet from Hermes Cargo.toml:
tokio = { version = "1.45.1", features = ["macros", "sync", "rt-multi-thread", "rt", "net"] } # Good formatting
libsqlite3-sys = {version="0.34.0", features = ["bundled"] } # Bad formatting
An extra CI check validating TOML files would be nice.
Description
Validating TOML files can be done with Taplo tool. It's available through cargo install
, NPM, as a binary, etc. Precise formatting rules can be controlled with taplo.toml file.
CI install & check
In catalyst-ci/earthly/rust/tools/Earthfile add:
tool-taplo-cli:
DO +CARGO_BINSTALL --package=taplo-cli --version=0.14.0
Then run it from catalyst-ci/earthly/rust/scripts/std_checks.py.
Configuration example
As one of the features, dependencies in Cargo.toml can be forced to be lexicographically ordered:
[formatting]
reorder_keys = false
[[rule]]
include = ["**/Cargo.toml"]
keys = ["dependencies"]
[rule.formatting]
reorder_keys = true
Note
Depending on the chosen configuration, some of the TOML files would need to be re-formatted.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
📋 Backlog