treefmt-nix icon indicating copy to clipboard operation
treefmt-nix copied to clipboard

Verify that formatters comply with the treefmt Formatter Specification

Open jfly opened this issue 7 months ago • 3 comments

See this recent PR: https://github.com/numtide/treefmt-nix/pull/356 (adding a wrapper for a formatter that doesn't accept multiple files). See our spec.

We could also confirm that formatters do not write to files when nothing has changed. See our spec.

I believe the other rules of the spec are hard/impossible to confirm harder to confirm.

jfly avatar May 18 '25 02:05 jfly

A good way to test this would be if we have two sample: one formatted, and one unformatted. That should be enough to test most of the spec's feature in a nix build sandbox.

zimbatm avatar May 18 '25 20:05 zimbatm

Or perhaps one unformatted sample that we format twice?

jfly avatar May 18 '25 21:05 jfly

It's something that has been on my mind for a while. It would be nice if treefmt itself could detect it, and then emit warning like "formatter XYZ violates rule nr3"

zimbatm avatar May 19 '25 08:05 zimbatm