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.

merlint: add cram test for E905 (Wire struct_/module_ in public API)

bad/ has foo/lib/foo.mli exposing struct_ — flagged because
struct_/module_/c_stubs/ml_stubs are EverParse build inputs that
belong in c/gen.ml, not the public API. good/ keeps the codec
exposed and the EverParse symbols private; lint passes.

+57
+1
test/cram/e905.t/bad/dune-project
··· 1 + (lang dune 3.21)
+1
test/cram/e905.t/bad/foo/lib/foo.ml
··· 1 + let codec = Wire.Codec.v "foo" reader writer
+4
test/cram/e905.t/bad/foo/lib/foo.mli
··· 1 + val codec : t Wire.Codec.t 2 + 3 + val struct_ : Wire_3d.struct_def 4 + (** EverParse 3D struct projection. *)
+1
test/cram/e905.t/good/dune-project
··· 1 + (lang dune 3.21)
+1
test/cram/e905.t/good/foo/lib/foo.ml
··· 1 + let codec = Wire.Codec.v "foo" reader writer
+1
test/cram/e905.t/good/foo/lib/foo.mli
··· 1 + val codec : t Wire.Codec.t
+48
test/cram/e905.t/run.t
··· 1 + Test bad example - foo.mli exposes Wire.struct_ symbol: 2 + $ merlint -B -r E905 bad/ 3 + Running merlint analysis... 4 + 5 + Analyzing 0 files 6 + 7 + ✓ Code Quality (0 total issues) 8 + ✓ Code Style (0 total issues) 9 + ✓ Naming Conventions (0 total issues) 10 + ✓ Documentation (0 total issues) 11 + ✓ Project Structure (0 total issues) 12 + ✓ Test Quality (0 total issues) 13 + ✓ Interop Testing (0 total issues) 14 + ✗ Code Generation (1 total issues) 15 + [E905] Wire struct_/module_ in public API (1 issue) 16 + Move struct_, module_, c_stubs, ml_stubs out of the .mli. These belong in 17 + c/gen.ml where they are used to generate EverParse 3D files and C stubs. The 18 + codec is the public API; the 3D projection is a build artifact. 19 + - (global) foo/foo.mli exposes Wire EverParse symbol `struct_` in public API 20 + 21 + ╭─────────────────┬──────────────────────────────────────────╮ 22 + │ Category │ Issues │ 23 + ├─────────────────┼──────────────────────────────────────────┤ 24 + │ Code Generation │ 1 (1 wire struct_/module_ in public api) │ 25 + ╰─────────────────┴──────────────────────────────────────────╯ 26 + 27 + 28 + Summary: ✗ 1 total issue (applied 1 rule) 29 + ✗ Some checks failed. See details above. 30 + [1] 31 + 32 + Test good example - foo.mli keeps Wire EverParse symbols out of the public API: 33 + $ merlint -B -r E905 good/ 34 + Running merlint analysis... 35 + 36 + Analyzing 0 files 37 + 38 + ✓ Code Quality (0 total issues) 39 + ✓ Code Style (0 total issues) 40 + ✓ Naming Conventions (0 total issues) 41 + ✓ Documentation (0 total issues) 42 + ✓ Project Structure (0 total issues) 43 + ✓ Test Quality (0 total issues) 44 + ✓ Interop Testing (0 total issues) 45 + ✓ Code Generation (0 total issues) 46 + 47 + Summary: ✓ 0 total issues (applied 1 rule) 48 + ✓ All checks passed!