Page
Library
Module
Module type
Parameter
Class
Class type
Source
Dead-code analyzer for OCaml
The tool assumes that .mli files are compiled with -keep-locs and .ml files with -bin-annot. Exported values are collected by reading .cmi or .cmt files (depending on the existence of an explicit .mli interface). References to such values are collected by reading typed trees from .cmt files
This tool scans a compiled OCaml project and reports various warnings about suspicious code:
None
). (The argument can be made mandatory or dropped.)unit
which are not ()
(typically, _
or a variable); let-binding to unit let () = ... in ...
(it's usually better to use sequencing); let-binding of the form let x = ... in x
(the binding is useless); optional argument in an argument's type: val f: ... -> (... -> ?_:_ -> ...) -> ...
opam install dead_code_analyzer
make
dead_code_analyzer
located in _build/install/default/bin/
dead_code_analyzer <options> <path>
The given paths can be files and directories. For more information about the usage, use the -help option.
To run the tests use make check
. For each subset of the tests a file <subset>.out
is generated, containg the output of the execution on it.
To run a subset of the tests call make -C check <subset>
.
You are welcome to clone this repository and send us back pull requests.
Read CONTRIBUTING.md
at the root of this directory for more informations on how to contribute.
The project is used internally at LexiFi.
There has been no official release yet.
Tracking the optional arguments uses may consume a lot of memory. Tracking the methods uses may consume a lot of memory.
Source code is distributed under the conditions stated in file License
This project was initiated by LexiFi (http://www.lexifi.com) and is part of the SecurOCaml project.
Contact: alain.frisch@lexifi.com