numtide / treefmt

one CLI to format your repo [maintainers=@zimbatm,@brianmcgee]
https://treefmt.com
MIT License
586 stars 37 forks source link

`cue fmt` always writes to the files #140

Open zimbatm opened 2 years ago

zimbatm commented 2 years ago

Describe the bug

cue fmt doesn't respect the treefmt spec and writes to the file, even if no changes occurred in the formatting.

To Reproduce

Run cue fmt somefile.cue && stat somefile.cue twice and see that the timestamp has changed twice.

Expected behavior

No change.

Additional context

This seems to be a known issue with Cue already: https://github.com/cue-lang/cue/issues/363

zimbatm commented 2 years ago

I wanted to fix upstream but at the point where the config is written back, the code has only an AST available. I think the AST would have to somehow be extended to carry a "modified" flag.

brianmcgee commented 1 month ago

@zimbatm is this something we still need to address?