Hello everyone,
Almost 10 years later, the dead_code_analyzer is coming back !
Thanks to all the more or less recent contributors and reviewers (I am not allowed to tag you all as a new user).
The tool has been updated to OCaml 5.2. It is available on opam
.
There is planned work to update it to OCaml 5.3.
There is planned work to offer a version compatible with OCaml 4.14. However, there is no intent to maintain the dead_code_analyzer
on any OCaml version other than the latest.
This static analyzer is a complement to the compiler’s warnings on unused code constructs. It reads .cmi and .cmt files, produced by using -keep-locs
(on by default) on .mli files and -bin-annot
on .ml files.
It scans a compiled OCaml project and reports various warnings about suspicious code:
- exported values never used,
- class fields never used,
- constructors and record fields never used,
- optional arguments always or never used,
- some stylistic issues.
By default, only the 3 first elements of the above list are reported.
More details available in the project’s README. A more thorough documentation is in progress.