rust-payjoin icon indicating copy to clipboard operation
rust-payjoin copied to clipboard

TOML files are inconsistently formatted

Open nothingmuch opened this issue 4 months ago • 3 comments

There's inconsistencies, in particular whitespace and ordering, in our Cargo.toml files

We should look into TOML formatting solutions and enforce in CI, to reduce unnecessary merge conflicts

nothingmuch avatar Aug 29 '25 12:08 nothingmuch

Yes I observe they need formatting accordingly one after the order and documenting how this can be treated in the future. I will love to work on this to get our TOML files clean and sorted.

Cyber-Lord avatar Aug 29 '25 13:08 Cyber-Lord

Thanks @Cyber-Lord! I assigned you.

I did zero research on viable solutions, so it would be great if you could summarize and we could discuss the available options here before opening a PR

nothingmuch avatar Aug 29 '25 14:08 nothingmuch

Hi @nothingmuch,

I did a research on available formatting tools for TOML files, especially Cargo.toml. And I found this tools worth reviewing:

  1. Taplo: A versatile, feature-rich TOML toolkit. It is actively maintained, supports formatting and linting, and integrates well with CI.
  2. cargo-sort: Cargo-sort crate can help us sort dependencies alphabetically in Cargo.toml.

This 2 tools when combined will achieve the desired result since it formats TOML files automatically and can be run from command line, we will end up with clean TOML files.

We can also update the CI file and add taplo format --check to enforce formatting. Let me know what you think about this approach.

Thank you

Cyber-Lord avatar Aug 29 '25 17:08 Cyber-Lord