ocaml/dune

dune fmt should be able to format single files

開放

#7,287 建立於 2023年3月11日

 (7 則留言) (2 個反應) (1 位負責人)OCaml (478 個分叉)github user discovery
good first issue

倉庫指標

星標
 (1,882 顆星)
PR 合併指標
 (平均合併 1天 20小時) (30 天內合併 345 個 PR)

描述

We should expand the capabilities of dune fmt so that it can format files passed on the command line. This would probably involve making a more serious implementation for it rather than just being a command line alias for dune build @fmt --auto-promote.

We have two cases for dune fmt file1.

  • If a file can be formatted, then we should format it according to whatever rule @fmt uses.
  • If it cannot be formatted then either we error or do nothing.

Perhaps we can control the behaviour of the second with an option which will allow users to hook up commit scripts like those proposed in https://github.com/ocaml/dune/issues/5107.

It would also pave the way for requesting a file to be formatted, which we can use to implement more sophisticated features like having the latest files changed in version control only be formatted. Again suggested in https://github.com/ocaml/dune/issues/5107.

I will need to do some more thinking about the implementation so making this ticket in the mean time.

貢獻者指南