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 E522 (package-prefixed module in main lib/)

+56
+1
test/cram/e522.t/bad/dune-project
··· 1 + (lang dune 3.21)
+1
test/cram/e522.t/bad/foo/lib/dune
··· 1 + (library (name foo) (public_name foo))
+1
test/cram/e522.t/bad/foo/lib/foo_bar.ml
··· 1 + let hello = "hi"
+1
test/cram/e522.t/good/dune-project
··· 1 + (lang dune 3.21)
+1
test/cram/e522.t/good/foo/lib/bar.ml
··· 1 + let hello = "hi"
+1
test/cram/e522.t/good/foo/lib/dune
··· 1 + (library (name foo) (public_name foo))
+50
test/cram/e522.t/run.t
··· 1 + Test bad example - foo/lib/foo_bar.ml has package-prefixed module name: 2 + $ merlint -B -r E522 bad/ 3 + Running merlint analysis... 4 + 5 + Analyzing 1 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 (1 total issues) 12 + [E522] Package-prefixed module in main lib/ instead of wrapped submodule (1 issue) 13 + Rename <pkg>/lib/<pkg>_foo.ml to <pkg>/lib/foo.ml (and update the .mli 14 + similarly). Dune's default wrapped mode will expose it as <Pkg>.Foo. For 15 + something that really needs its own public name, create a sublib directory 16 + (<pkg>/lib_foo/ with its own dune) instead. 17 + - (global) foo/lib/foo_bar.ml uses package-prefixed module name; drop the prefix and let dune's wrapping expose it as a submodule, or move it into a sublib directory 18 + ✓ Test Quality (0 total issues) 19 + ✓ Interop Testing (0 total issues) 20 + ✓ Code Generation (0 total issues) 21 + 22 + ╭───────────────────┬────────────────────────────────────────────────────────╮ 23 + │ Category │ Issues │ 24 + ├───────────────────┼────────────────────────────────────────────────────────┤ 25 + │ Project Structure │ 1 (1 package-prefixed module in main lib/ instead of │ 26 + │ │ wrapped submodule) │ 27 + ╰───────────────────┴────────────────────────────────────────────────────────╯ 28 + 29 + 30 + Summary: ✗ 1 total issue (applied 1 rule) 31 + ✗ Some checks failed. See details above. 32 + [1] 33 + 34 + Test good example - foo/lib/bar.ml has no package prefix: 35 + $ merlint -B -r E522 good/ 36 + Running merlint analysis... 37 + 38 + Analyzing 1 files 39 + 40 + ✓ Code Quality (0 total issues) 41 + ✓ Code Style (0 total issues) 42 + ✓ Naming Conventions (0 total issues) 43 + ✓ Documentation (0 total issues) 44 + ✓ Project Structure (0 total issues) 45 + ✓ Test Quality (0 total issues) 46 + ✓ Interop Testing (0 total issues) 47 + ✓ Code Generation (0 total issues) 48 + 49 + Summary: ✓ 0 total issues (applied 1 rule) 50 + ✓ All checks passed!