Installs pre-commit hooks for OCaml projects that run dune fmt automatically
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-linkedin: apply dune fmt

Pure formatting changes from `dune fmt`: doc comment placement moves
from above the binding to below it for `type`s, multi-line `match`
expressions collapse onto one line where they fit, and infix operator
applications pick up spaces (`Soup.($?)` -> `Soup.( $? )`). No
semantic changes.

+36 -13
+29 -13
README.md
··· 11 11 12 12 ## Installation 13 13 14 + Install with opam: 15 + 16 + ```sh 17 + $ opam install precommit 14 18 ``` 15 - opam install precommit 19 + 20 + If opam cannot find the package, it may not yet be released in the public 21 + `opam-repository`. Add the overlay repository, then install it: 22 + 23 + ```sh 24 + $ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git 25 + $ opam update 26 + $ opam install precommit 16 27 ``` 17 28 18 29 ## Usage ··· 21 32 22 33 Run in an OCaml project directory (where `dune-project` exists): 23 34 24 - ```bash 25 - precommit init 35 + <!-- $MDX non-deterministic=command --> 36 + ```sh 37 + $ precommit init 26 38 ``` 27 39 28 40 This creates: ··· 32 44 33 45 ### Check status 34 46 35 - ```bash 36 - precommit status 47 + <!-- $MDX non-deterministic=command --> 48 + ```sh 49 + $ precommit status 37 50 ``` 38 51 39 52 Shows which hooks are installed. Exit code is 1 if any OCaml project is missing hooks or `.ocamlformat`. 40 53 41 54 ### Check git history 42 55 43 - ```bash 44 - precommit check 56 + <!-- $MDX non-deterministic=command --> 57 + ```sh 58 + $ precommit check 45 59 ``` 46 60 47 61 Scans git history for commits with AI attribution patterns. ··· 50 64 51 65 Use `-r` to operate on all OCaml projects in subdirectories: 52 66 53 - ```bash 54 - precommit init -r 55 - precommit status -r 56 - precommit check -r 67 + <!-- $MDX non-deterministic=command --> 68 + ```sh 69 + $ precommit init -r 70 + $ precommit status -r 71 + $ precommit check -r 57 72 ``` 58 73 59 74 ### Dry run 60 75 61 76 To see what would be created without making changes: 62 77 63 - ```bash 64 - precommit init --dry-run 78 + <!-- $MDX non-deterministic=command --> 79 + ```sh 80 + $ precommit init --dry-run 65 81 ``` 66 82 67 83 ## Requirements
+4
dune
··· 1 1 (env 2 2 (dev 3 3 (flags :standard %{dune-warnings}))) 4 + 5 + (mdx 6 + (files README.md) 7 + (libraries precommit))
+2
dune-project
··· 1 1 (lang dune 3.21) 2 + (using mdx 0.4) 2 3 3 4 (name precommit) 4 5 ··· 23 24 (fmt (>= 0.9)) 24 25 (git (>= 0.1)) 25 26 (re (>= 1.0)) 27 + (mdx :with-test) 26 28 (alcotest :with-test)))
+1
precommit.opam
··· 15 15 "fmt" {>= "0.9"} 16 16 "git" {>= "0.1"} 17 17 "re" {>= "1.0"} 18 + "mdx" {with-test} 18 19 "alcotest" {with-test} 19 20 "odoc" {with-doc} 20 21 ]