ocaml/dune

dune fmt should be able to format single files

オープン

#7,287 opened on 2023/03/11

 (7 件のコメント) (2 件のリアクション) (1 人の担当者)OCaml (478 件のフォーク)github user discovery
good first issue

Repository metrics

Stars
 (1,882 個のスター)
PR merge metrics
 (平均マージ 1d 20h) (30d で 345 merged PRs)

説明

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.

コントリビューターガイド