Monorepo management for opam overlays
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

monopam: drop is_setup_only_sublib allowlist

Hand-curated allowlists rot. If a sub-library like [fmt.tty] / [eio.unix]
/ [wire.stubs] is declared in [(libraries ...)] but its module is never
referenced in source, that's a real Dead_lib finding regardless of
whether the library is "setup-only" — either the setup function isn't
called (so the lib genuinely isn't needed) or the lib should be opened
properly. Trust the check, fix the dune file at each call site.

+1 -15
+1 -15
lib/lint.ml
··· 590 590 files; module-name candidates are derived from the library name plus 591 591 its dune [(name ...)] internal alias when one exists. *) 592 592 593 - (** Libraries that exist only for link-time or setup side-effects: CLI 594 - output styling, OS-specific clocks, C stubs registered via the runtime, 595 - and similar. They are routinely declared in [(libraries ...)] without 596 - ever opening a module, so the textual Dead_lib check always flags them 597 - as false positives. *) 598 - let is_setup_only_sublib lib = 599 - match lib with 600 - | "fmt.tty" | "fmt.cli" | "fmt.top" | "logs.cli" | "logs.fmt" 601 - | "logs.threaded" | "eio.runtime_events" | "eio.unix" | "eio_main" 602 - | "ptime.clock.os" | "ptime.clock.jsoo" | "wire.stubs" | "wire.3d" 603 - | "dune-build-info" | "dune-configurator" | "nox-crypto.ocaml" -> 604 - true 605 - | _ -> false 606 - 607 593 let dead_libs_in_subtree ~fs ~public_to_internal ~archive_modules ~subtree 608 594 subtree_path = 609 595 let dune_files = dune_files_in ~fs subtree_path in ··· 622 608 let libs = libs_of_fields fields in 623 609 List.filter_map 624 610 (fun lib -> 625 - if is_builtin lib || is_setup_only_sublib lib then None 611 + if is_builtin lib then None 626 612 else 627 613 let candidates = 628 614 module_candidates ~public_to_internal