From 2c52df1fae92c3e0eedcee3a4f507d99ccb1d62f Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Thu, 12 Mar 2026 21:38:51 -0400 Subject: [PATCH] add pre-commit hook for formatting --- .pre-commit-config.yaml | 10 ++++++++++ Makefile | 3 +++ 2 files changed, 13 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..d3cd5cd1 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,10 @@ +repos: + - repo: local + hooks: + - id: ocamlformat + name: ocamlformat check + entry: make format-check + language: system + files: \.(ml|mli)$ + pass_filenames: false + stages: [pre-push] diff --git a/Makefile b/Makefile index 0ae04b40..d7f9a4ff 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,9 @@ format: format-check: @dune build $(DUNE_OPTS) @fmt --display=quiet +setup-githooks: + uvx pre-commit install --hook-type pre-push + WATCH ?= @all watch: @dune build $(WATCH) -w $(OPTS)