Skip to content

Commit 8ad48b5

Browse files
authored
flambda-backend: Use only .ocamlformat* to enable or disable ocamlformat (#1135)
Currently, we have two ways of expressing which files are ocamlformatted: ocamlformat's own configuration files, and the logic hardcoded into the `make fmt` implementation. Editors use `.ocamlformat` and friends to see which files to format, and CI uses `make fmt` to check that things are formatted. Unfortunately, these mechanisms have gone out of sync - there are several files that are formatted according to `.ocamlformat` or `.ocamlformat-enable` but are missing from `make fmt`, so the only effect of enabling ocamlformat on them is a fun surprise when you go and save a file. Notably, ocamlformat's behaviour is to take a list of files and format only the ones it's configured to. So `make fmt` can only go wrong by passing _too few_ files, not too many. This PR changes `make fmt` so that it just passes every last `.ml` and `.mli` file in the repo to the `ocamlformat` command line, making `.ocamlformat`, `.ocamlformat-ignore`, and `.ocamlformat-enable` files the source of truth about which files get formatted. I've adjusted these files to reflect the status quo, so the only immediate impact here is that editors behave predictably. (Note that some changes reflect a subtle fact about ocamlformat: Once a file is listed in `.ocamlformat-enable`, it cannot be `.ocamlformat-ignore`d. Thus adding a deeper `.ocamlformat` with `disable=false` is preferable to using a wildcard match in `.ocamlformat-enable`.)
1 parent 1aa2885 commit 8ad48b5

File tree

2 files changed

+1
-1
lines changed

2 files changed

+1
-1
lines changed

lambda/.ocamlformat-enable

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
disable=true

0 commit comments

Comments
 (0)