Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Set-up OCaml
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: "5.2"
ocaml-compiler: "5.3"

- run: opam install . --deps-only --with-test

Expand All @@ -45,7 +45,7 @@ jobs:
- name: Set-up OCaml
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: "5.2"
ocaml-compiler: "5.3"
- uses: ocaml/setup-ocaml/lint-doc@v3

lint-opam:
Expand All @@ -56,5 +56,5 @@ jobs:
- name: Set-up OCaml
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: "5.2"
ocaml-compiler: "5.3"
- uses: ocaml/setup-ocaml/lint-opam@v3
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Dead-code analyzer for OCaml
## Overview

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 with **-bin-annot**. Exported values are collected by reading .cmti 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

Expand Down Expand Up @@ -38,7 +38,7 @@ For more information, see [the documentation](docs/USER_DOC.md)

## Requirements

- Currently tested and working on **OCaml 5.2**
- Currently tested and working on **OCaml 5.3**


## Install
Expand Down
12 changes: 6 additions & 6 deletions check/classic/classic.ref
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ Nothing else to report in this section

.> UNUSED CONSTRUCTORS/RECORD FIELDS:
====================================
./examples/using_dune/preprocessed_lib/preprocessed.mli:14: constructors.Unused
./examples/using_dune/preprocessed_lib/preprocessed.mli:19: constr_with_eq.Unused
./examples/using_dune/preprocessed_lib/preprocessed.mli:23: record.unused
./examples/using_dune/preprocessed_lib/preprocessed.mli:14: constructors.Unused: Not detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:19: constr_with_eq.Unused: Not detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:23: record.unused: Not detected
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:25: constructors.Unused
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:30: constr_with_eq.Unused
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:39: record.unused
Expand Down Expand Up @@ -534,6 +534,6 @@ Nothing else to report in this section


Total: 460
Success: 460
Failed: 0
Ratio: 100.%
Success: 457
Failed: 3
Ratio: 99.347826087%
15 changes: 8 additions & 7 deletions check/internal/internal.ref
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.> UNUSED EXPORTED VALUES:
=========================
./examples/using_dune/preprocessed_lib/preprocessed.mli:1: unused
./examples/using_dune/preprocessed_lib/preprocessed.mli:3: internally_used: Should not be detected
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:2: unused

./examples/using_dune/unwrapped_lib/opt_args/opt_args.mli:1: unused_fun_with_single_never_used_opt_arg
Expand Down Expand Up @@ -135,9 +136,9 @@ Nothing else to report in this section

.> UNUSED CONSTRUCTORS/RECORD FIELDS:
====================================
./examples/using_dune/preprocessed_lib/preprocessed.mli:14: constructors.Unused
./examples/using_dune/preprocessed_lib/preprocessed.mli:19: constr_with_eq.Unused
./examples/using_dune/preprocessed_lib/preprocessed.mli:23: record.unused
./examples/using_dune/preprocessed_lib/preprocessed.mli:14: constructors.Unused: Not detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:19: constr_with_eq.Unused: Not detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:23: record.unused: Not detected
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:25: constructors.Unused
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:30: constr_with_eq.Unused
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:39: record.unused
Expand Down Expand Up @@ -501,7 +502,7 @@ Nothing else to report in this section
--------------------------------------------------------------------------------


Total: 430
Success: 430
Failed: 0
Ratio: 100.%
Total: 431
Success: 427
Failed: 4
Ratio: 99.0719257541%
30 changes: 18 additions & 12 deletions check/threshold-1/threshold-1.ref
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.> UNUSED EXPORTED VALUES:
=========================
./examples/using_dune/preprocessed_lib/preprocessed.mli:1: unused
./examples/using_dune/preprocessed_lib/preprocessed.mli:3: internally_used: Should not be detected
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:2: unused

./examples/using_dune/unwrapped_lib/opt_args/opt_args.mli:1: unused_fun_with_single_never_used_opt_arg
Expand Down Expand Up @@ -103,8 +104,10 @@
./examples/using_dune/bin/use_wrapped_lib/use_without_class.mli:1: mark_used
./examples/using_dune/bin/use_wrapped_lib/use_wrapped_lib.mli:1: mark_used

./examples/using_dune/preprocessed_lib/preprocessed.mli:3: internally_used
./examples/using_dune/preprocessed_lib/preprocessed.mli:2: used: Should not be detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:3: internally_used: Not detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:4: externally_used
./examples/using_dune/preprocessed_lib/preprocessed.mli:31: f: Should not be detected
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:4: internally_used
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:5: externally_used

Expand Down Expand Up @@ -369,9 +372,9 @@ Nothing else to report in this section

.> UNUSED CONSTRUCTORS/RECORD FIELDS:
====================================
./examples/using_dune/preprocessed_lib/preprocessed.mli:14: constructors.Unused
./examples/using_dune/preprocessed_lib/preprocessed.mli:19: constr_with_eq.Unused
./examples/using_dune/preprocessed_lib/preprocessed.mli:23: record.unused
./examples/using_dune/preprocessed_lib/preprocessed.mli:14: constructors.Unused: Not detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:19: constr_with_eq.Unused: Not detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:23: record.unused: Not detected
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:25: constructors.Unused
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:30: constr_with_eq.Unused
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:39: record.unused
Expand Down Expand Up @@ -441,10 +444,13 @@ Nothing else to report in this section

.>-> ALMOST UNUSED CONSTRUCTORS/RECORD FIELDS: Called 1 time(s):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./examples/using_dune/preprocessed_lib/preprocessed.mli:16: constructors.Internally_used
./examples/using_dune/preprocessed_lib/preprocessed.mli:17: constructors.Externally_used
./examples/using_dune/preprocessed_lib/preprocessed.mli:25: record.internally_used
./examples/using_dune/preprocessed_lib/preprocessed.mli:26: record.externally_used
./examples/using_dune/preprocessed_lib/preprocessed.mli:14: constructors.Unused: Should not be detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:16: constructors.Internally_used: Not detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:17: constructors.Externally_used: Not detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:19: constr_with_eq.Unused: Should not be detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:23: record.unused: Should not be detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:25: record.internally_used: Not detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:26: record.externally_used: Not detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:29: record_with_eq.implicitly_used
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:27: constructors.Internally_used
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:28: constructors.Externally_used
Expand Down Expand Up @@ -809,7 +815,7 @@ Nothing else to report in this section
--------------------------------------------------------------------------------


Total: 701
Success: 701
Failed: 0
Ratio: 100.%
Total: 707
Success: 693
Failed: 14
Ratio: 98.0198019802%
54 changes: 34 additions & 20 deletions check/threshold-3-0.5/threshold-3-0.5.ref
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.> UNUSED EXPORTED VALUES:
=========================
./examples/using_dune/preprocessed_lib/preprocessed.mli:1: unused
./examples/using_dune/preprocessed_lib/preprocessed.mli:3: internally_used: Should not be detected
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:2: unused

./examples/using_dune/unwrapped_lib/opt_args/opt_args.mli:1: unused_fun_with_single_never_used_opt_arg
Expand Down Expand Up @@ -103,8 +104,10 @@
./examples/using_dune/bin/use_wrapped_lib/use_without_class.mli:1: mark_used
./examples/using_dune/bin/use_wrapped_lib/use_wrapped_lib.mli:1: mark_used

./examples/using_dune/preprocessed_lib/preprocessed.mli:3: internally_used
./examples/using_dune/preprocessed_lib/preprocessed.mli:2: used: Should not be detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:3: internally_used: Not detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:4: externally_used
./examples/using_dune/preprocessed_lib/preprocessed.mli:31: f: Should not be detected
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:4: internally_used
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:5: externally_used

Expand Down Expand Up @@ -239,8 +242,9 @@

.>-> ALMOST UNUSED EXPORTED VALUES: Called 2 time(s):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./examples/using_dune/preprocessed_lib/preprocessed.mli:2: used
./examples/using_dune/preprocessed_lib/preprocessed.mli:31: f
./examples/using_dune/preprocessed_lib/preprocessed.mli:2: used: Not detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:31: f: Not detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:6: immediate: Should not be detected
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:3: used
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:53: f

Expand Down Expand Up @@ -515,9 +519,9 @@ Nothing else to report in this section

.> UNUSED CONSTRUCTORS/RECORD FIELDS:
====================================
./examples/using_dune/preprocessed_lib/preprocessed.mli:14: constructors.Unused
./examples/using_dune/preprocessed_lib/preprocessed.mli:19: constr_with_eq.Unused
./examples/using_dune/preprocessed_lib/preprocessed.mli:23: record.unused
./examples/using_dune/preprocessed_lib/preprocessed.mli:14: constructors.Unused: Not detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:19: constr_with_eq.Unused: Not detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:23: record.unused: Not detected
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:25: constructors.Unused
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:30: constr_with_eq.Unused
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:39: record.unused
Expand Down Expand Up @@ -587,10 +591,13 @@ Nothing else to report in this section

.>-> ALMOST UNUSED CONSTRUCTORS/RECORD FIELDS: Called 1 time(s):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./examples/using_dune/preprocessed_lib/preprocessed.mli:16: constructors.Internally_used
./examples/using_dune/preprocessed_lib/preprocessed.mli:17: constructors.Externally_used
./examples/using_dune/preprocessed_lib/preprocessed.mli:25: record.internally_used
./examples/using_dune/preprocessed_lib/preprocessed.mli:26: record.externally_used
./examples/using_dune/preprocessed_lib/preprocessed.mli:14: constructors.Unused: Should not be detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:16: constructors.Internally_used: Not detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:17: constructors.Externally_used: Not detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:19: constr_with_eq.Unused: Should not be detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:23: record.unused: Should not be detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:25: record.internally_used: Not detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:26: record.externally_used: Not detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:29: record_with_eq.implicitly_used
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:27: constructors.Internally_used
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:28: constructors.Externally_used
Expand Down Expand Up @@ -661,8 +668,12 @@ Nothing else to report in this section

.>-> ALMOST UNUSED CONSTRUCTORS/RECORD FIELDS: Called 2 time(s):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./examples/using_dune/preprocessed_lib/preprocessed.mli:15: constructors.Used
./examples/using_dune/preprocessed_lib/preprocessed.mli:24: record.used
./examples/using_dune/preprocessed_lib/preprocessed.mli:15: constructors.Used: Not detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:16: constructors.Internally_used: Should not be detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:17: constructors.Externally_used: Should not be detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:24: record.used: Not detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:25: record.internally_used: Should not be detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:26: record.externally_used: Should not be detected
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:26: constructors.Used
./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:40: record.used

Expand Down Expand Up @@ -699,11 +710,14 @@ Nothing else to report in this section
--------



Nothing else to report in this section
--------------------------------------------------------------------------------


.>-> ALMOST UNUSED CONSTRUCTORS/RECORD FIELDS: Called 3 time(s):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./examples/using_dune/preprocessed_lib/preprocessed.mli:15: constructors.Used: Should not be detected
./examples/using_dune/preprocessed_lib/preprocessed.mli:24: record.used: Should not be detected
Nothing else to report in this section
--------------------------------------------------------------------------------
.> OPTIONAL ARGUMENTS: ALWAYS:
=============================
./examples/using_dune/preprocessed_lib/preprocessed.ml:53: ?always
Expand Down Expand Up @@ -920,7 +934,6 @@ Nothing else to report in this section
./examples/using_make/dir/matchopt.ml:1: ?x (3/4 calls)
./examples/using_make/dir/ref_fn.ml:1: ?a (2/3 calls)
./examples/using_make/dir/ref_fn.ml:1: ?b (2/3 calls)

./examples/using_make/matchopt.ml:1: ?x (3/4 calls)

./examples/using_make/opt/sig_struct.ml:2: ?x (2/3 calls)
Expand Down Expand Up @@ -1107,6 +1120,7 @@ Nothing else to report in this section
./examples/using_make/dir/anonFn2.mli:1: ?b (2/3 calls)
./examples/using_make/dir/matchopt.ml:1: ?y (3/4 calls)
./examples/using_make/dir/matchopt.ml:1: ?z (3/4 calls)

./examples/using_make/let_in.ml:1: ?b (2/3 calls)
./examples/using_make/matchopt.ml:1: ?y (3/4 calls)
./examples/using_make/matchopt.ml:1: ?z (3/4 calls)
Expand Down Expand Up @@ -1168,7 +1182,7 @@ Nothing else to report in this section
--------------------------------------------------------------------------------


Total: 988
Success: 988
Failed: 0
Ratio: 100.%
Total: 1001
Success: 976
Failed: 25
Ratio: 97.5024975025%
4 changes: 2 additions & 2 deletions dead_code_analyzer.opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "1.0.0"
version: "1.0.1"
synopsis: "Dead code analyzer for OCaml"
maintainer: [
"Alain Frisch <[email protected]>"
Expand All @@ -15,7 +15,7 @@ homepage: "https://github.com/LexiFi/dead_code_analyzer"
bug-reports: "https://github.com/LexiFi/dead_code_analyzer/issues"
depends: [
"dune" {>= "3.20"}
"ocaml" {>= "5.2" & < "5.3"}
"ocaml" {>= "5.3" & < "5.4"}
"odoc" {with-doc}
]
build: [
Expand Down
14 changes: 7 additions & 7 deletions docs/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
Calling `dead_code_analyzer --help` provides the following output, describing
the main command line aspect, different options available and their effects.

The `<path>` argument is any number of directory, `.cmt` and `.cmi` files.
The `<path>` argument is any number of directory, `.cmt` and `.cmti` files.
These files can be produced using the compiler flags `-keep-locs` (on by default)
for `.cmi` and `-bin-annot` for `.cmt`.
for `.cmti` and `-bin-annot` for `.cmt`.
The directories are traversed looking for such files.
> [!TIP]
> If you are using `dune` for your project, the files can be obtained via the
Expand Down Expand Up @@ -190,15 +190,15 @@ the development.
```
src
├── debug
│   ├── debug.cmi
│   ├── debug.cmti
│   ├── debug.cmt
│   └── debug.ml
├── foo.cmi
├── foo.cmti
├── foo.cmt
├── foo.ml
├── foo.mli
└── lib
├── lib.cmi
├── lib.cmti
├── lib.cmt
├── lib.ml
└── lib.mli
Expand Down Expand Up @@ -306,9 +306,9 @@ the file and moves on.

- If a file is ignored and it is not obvious why, then opening an issue is
welcome.
- If no file is ignored, check that no file is missing. There should be a `.cmi`
- If no file is ignored, check that no file is missing. There should be a `.cmti`
and a `.cmt` file for each expected `<file_path>`.
- If no `.cmi` or `.cmt` file is missing then the false negatives must be due
- If no `.cmti` or `.cmt` file is missing then the false negatives must be due
to limitations of the tool and opening an issue is welcome.

## Thresholds
Expand Down
4 changes: 2 additions & 2 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

(generate_opam_files true)

(version 1.0.0)
(version 1.0.1)

(maintainers
"Alain Frisch <[email protected]>"
Expand All @@ -22,6 +22,6 @@
(synopsis "Dead code analyzer for OCaml")
(license MIT)
(depends
(ocaml (and (>= 5.2) (< 5.3)))
(ocaml (and (>= 5.3) (< 5.4)))
)
)
Loading