Opinionated OCaml linter with Merlin integration for code quality, naming conventions, and style checks
0
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.

+69 -36
+55 -33
README.md
··· 61 61 ## Quick Start 62 62 63 63 ### Installation 64 - ```bash 65 - opam install . --deps-only 66 - dune build 67 - dune install 64 + 65 + Install with opam: 66 + 67 + ```sh 68 + $ opam install merlint 69 + ``` 70 + 71 + If opam cannot find the package, it may not yet be released in the public 72 + `opam-repository`. Add the overlay repository, then install it: 73 + 74 + ```sh 75 + $ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git 76 + $ opam update 77 + $ opam install merlint 78 + ``` 79 + 80 + To build from source instead: 81 + 82 + <!-- $MDX non-deterministic=command --> 83 + ```sh 84 + $ opam install . --deps-only 85 + $ dune build 86 + $ dune install 68 87 ``` 69 88 70 89 ### Usage 71 - ```bash 72 - # Analyse the entire project 73 - merlint 90 + <!-- $MDX non-deterministic=command --> 91 + ```sh 92 + $ # Analyse the entire project 93 + $ merlint 74 94 75 - # Analyse specific files or directories 76 - merlint src/ lib/ 95 + $ # Analyse specific files or directories 96 + $ merlint src/ lib/ 77 97 78 - # Exclude directories 79 - merlint --exclude test/ 98 + $ # Exclude directories 99 + $ merlint --exclude test/ 80 100 81 - # Filter rules (e.g., run all rules except E110) 82 - merlint --rules A-E110 101 + $ # Filter rules (e.g., run all rules except E110) 102 + $ merlint --rules A-E110 83 103 ``` 84 104 85 105 ## Configuration ··· 118 138 ## Integration 119 139 120 140 ### Git Pre-commit Hook 121 - ```bash 122 - # Add to .git/hooks/pre-commit 123 - #!/bin/bash 124 - echo "Running merlint analysis..." 125 - if command -v merlint >/dev/null 2>&1; then 126 - merlint --exclude test/ 127 - if [ $? -ne 0 ]; then 128 - echo "❌ Merlint found issues. Please fix them before committing." 129 - exit 1 130 - fi 131 - else 132 - echo "⚠️ Warning: merlint not found. Skipping analysis." 133 - fi 141 + <!-- $MDX non-deterministic=command --> 142 + ```sh 143 + $ # Add to .git/hooks/pre-commit 144 + $ #!/bin/bash 145 + $ echo "Running merlint analysis..." 146 + $ if command -v merlint >/dev/null 2>&1; then 147 + $ merlint --exclude test/ 148 + $ if [ $? -ne 0 ]; then 149 + $ echo "❌ Merlint found issues. Please fix them before committing." 150 + $ exit 1 151 + $ fi 152 + $ else 153 + $ echo "⚠️ Warning: merlint not found. Skipping analysis." 154 + $ fi 134 155 ``` 135 156 136 157 ### CI/CD ··· 148 169 149 170 ## Development 150 171 151 - ```bash 152 - # Run tests 153 - dune runtest 172 + <!-- $MDX non-deterministic=command --> 173 + ```sh 174 + $ # Run tests 175 + $ dune runtest 154 176 155 - # Format code 156 - dune fmt 177 + $ # Format code 178 + $ dune fmt 157 179 158 - # Test on the codebase itself 159 - merlint lib/ bin/ 180 + $ # Test on the codebase itself 181 + $ merlint lib/ bin/ 160 182 ``` 161 183 162 184 ### Architecture
+4
dune
··· 1 1 (env 2 2 (dev 3 3 (flags :standard %{dune-warnings}))) 4 + 5 + (mdx 6 + (files README.md) 7 + (libraries merlint))
+2
dune-project
··· 1 1 (lang dune 3.21) 2 + (using mdx 0.4) 2 3 (using directory-targets 0.1) 3 4 (name merlint) 4 5 (generate_opam_files true) ··· 31 32 tty 32 33 vlog 33 34 (alcotest :with-test) 35 + (mdx :with-test) 34 36 loc))
+1
merlint.opam
··· 27 27 "tty" 28 28 "vlog" 29 29 "alcotest" {with-test} 30 + "mdx" {with-test} 30 31 "loc" 31 32 "odoc" {with-doc} 32 33 ]
+4 -3
scripts/README.md
··· 22 22 23 23 Run from the project root: 24 24 25 - ```bash 26 - ./scripts/setup-hooks.sh 25 + <!-- $MDX non-deterministic=command --> 26 + ```sh 27 + $ ./scripts/setup-hooks.sh 27 28 ``` 28 29 29 30 ### Notes ··· 32 33 - You need to run the setup script on each clone of the repository 33 34 - To bypass the pre-commit hook in emergencies: `git commit --no-verify` 34 35 - The script uses the project's own merlint via `dune exec -- merlint` 35 - - For the merlint project itself: Use `--no-verify` until we migrate from Printf to Fmt 36 + - For the merlint project itself: Use `--no-verify` until we migrate from Printf to Fmt
+3
scripts/dune
··· 1 + (mdx 2 + (libraries merlint) 3 + (files README.md))