ocaml / dune

A composable build system for OCaml.
https://dune.build/
MIT License
1.63k stars 401 forks source link

disable auto formatting for specific dune files #10862

Open Khady opened 1 month ago

Khady commented 1 month ago

Desired Behavior

In a dune file, having a stanza (formatting disabled) would ensure that the file doesn't get touched when dune build @fmt runs.

We have dune files where the content written by hand is much more readable then when it's being auto formatted. Often because of what is explained in #10861, but not only. In those cases it would be nice to be able to preserve part of a dune file or a whole dune file.

rgrinberg commented 2 days ago

Sure, this seems like a fine feature to have. Instead of making it file based, I wonder if we can just have a without_formatting stanza.

In any case, PR's welcome and I'm not going to be too picky about the solution because of how niche this sounds.