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 E524 (multiple Cmd.v in one file)

+62
+1
test/cram/e524.t/bad/dune-project
··· 1 + (lang dune 3.21)
+6
test/cram/e524.t/bad/main.ml
··· 1 + open Cmdliner 2 + 3 + let foo = Cmd.v (Cmd.info "foo") Term.(const ()) 4 + let bar = Cmd.v (Cmd.info "bar") Term.(const ()) 5 + 6 + let () = exit (Cmd.eval (Cmd.group (Cmd.info "app") [ foo; bar ]))
+1
test/cram/e524.t/good/dune-project
··· 1 + (lang dune 3.21)
+5
test/cram/e524.t/good/main.ml
··· 1 + open Cmdliner 2 + 3 + let foo = Cmd.v (Cmd.info "foo") Term.(const ()) 4 + 5 + let () = exit (Cmd.eval foo)
+49
test/cram/e524.t/run.t
··· 1 + Test bad example - main.ml defines two Cmd.v subcommands: 2 + $ merlint -B -r E524 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 (1 total issues) 12 + [E524] Multiple Cmdliner subcommands in one file (1 issue) 13 + Each Cmd.v subcommand should live in its own file. Move each Cmd.v into a 14 + sibling file (e.g. cmd_<name>.ml exposing a single val cmd) and reference it 15 + from main.ml's Cmd.group. Sub-subcommands of a grouped subcommand follow the 16 + same rule — use cmd_<parent>/<leaf>.ml or cmd_<parent>_<leaf>.ml siblings. 17 + - (global) bad/main.ml defines 2 Cmdliner subcommands in one file; split them into one file per subcommand 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 multiple cmdliner subcommands in one file) │ 26 + ╰───────────────────┴─────────────────────────────────────────────────╯ 27 + 28 + 29 + Summary: ✗ 1 total issue (applied 1 rule) 30 + ✗ Some checks failed. See details above. 31 + [1] 32 + 33 + Test good example - main.ml defines a single Cmd.v subcommand: 34 + $ merlint -B -r E524 good/ 35 + Running merlint analysis... 36 + 37 + Analyzing 0 files 38 + 39 + ✓ Code Quality (0 total issues) 40 + ✓ Code Style (0 total issues) 41 + ✓ Naming Conventions (0 total issues) 42 + ✓ Documentation (0 total issues) 43 + ✓ Project Structure (0 total issues) 44 + ✓ Test Quality (0 total issues) 45 + ✓ Interop Testing (0 total issues) 46 + ✓ Code Generation (0 total issues) 47 + 48 + Summary: ✓ 0 total issues (applied 1 rule) 49 + ✓ All checks passed!