This repo contains a pre-commit hook for ocamlformat.
This doesn't sandbox the command at all, so you'll need ocamlformat
available locally:
opam install ocamlformat
Note: There's a docker branch which sandboxes this, but it's a lot slower and barely tested.
In your .pre-commit-config.yaml:
- repo: https://github.com/arenadotio/pre-commit-ocamlformat
rev: master # or pick a commit sha I guess
hooks:
- id: ocamlformat
Note: ocamlformat will get confused if you try to run it against vendored files, so you may need add an exclude filter like:
- repo: https://github.com/arenadotio/pre-commit-ocamlformat
rev: master
hooks:
- id: ocamlformat
exclude: "^vendor/"