Inspired by:
- How possible is a clippy-like linter for OCaml?
- My experience in teaching OCaml at my local university.
At the moment most of implemented lints are inspired by me teaching experience. But I'm aware that there are other linters like Camelot for OCaml and Clippy Rust.
From techinical point of view, most of the lints study Typedtree, so the input for linter should be a fully compiled dune project. There is a support of linters that study untyped tree, but I don't expect them to be widely used. These two abstract trees don't allow to find all possible code quirks. Currently, we delegate job of detecting something like f(1)(2)(3)
to ocamlformat.
Examples of 'zanuda' usage could be found in the 'tests' directory. But in short:
-
Compile your dune project and run this linter via
dune build . @runtest -j3 zanuda -dir .
It will report found issues using OCaml's alerts
-
You could read the documentation about supported lints via
zanuda -dump
. CI runs regularly uploads information about available lints to GitHub Pages. -
You could run linter and dump the results in short JSON form. They could be processed later, for example as review comment via GitHub API. (This reporting is not implemented yet.)
Current dependecies:
opam install ppx_fields_conv ppx_blob base angstrom ppx_expect ppx_assert sexplib --yes
Running a single test:
dune build && dune build @ifbool --force
Running all tests:
dune build && dune runtest --force
- Ocp-lint paper
- Lexifi's dead dead_code_analyzer
- Camelot
- ometrics