package ppx_enforce
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=092a959c08fd1275987c2cc001b9c693
sha512=6f1d5c1e522160d35bb5fc61b0f21bf0e41e1b7a32602fe3aee47f9f878b2d9f8e01307d19c03b8e7da410ab073bbd0ac87a1a744eda56e04046e9e74fcd4888
doc/ppx_enforce/Ppx_enforce/index.html
Module Ppx_enforceSource
PPX rewriter that enforces the presence of specific function calls at compile time. The mirror of ppx_forbid: raises a compilation error when a required call is *absent* from a source file.
Usage: Add to dune file: (preprocess (pps ppx_enforce))
Suppression: Add [@@@enforce_exempt] at the top of a file to skip all enforcement checks for that file: @@@enforce_exempt (* this file is intentionally exempt *)
Or exempt a specific requirement: @@@enforce_exempt "Miaou_registry.register"
Configuration: Create a .ppx_enforce file in your project root with: # Enforce that Miaou_registry.register is called somewhere in the file call Miaou_registry.register "Widget must self-register via Miaou_registry.register ~name ~mli:%blob ..."
If no config file is found, no requirements are enforced.
A single enforcement requirement.
Parse a config line. Returns None for comments/empty lines.
Load config from a file.
Find config file by walking up directory tree.
Strip dune sandbox/build prefix to get source path.
Check for @@@enforce_exempt or @@@enforce_exempt "Mod.fn" attributes at the structure level. Returns:
- `All → file is fully exempt
- `Some s → only the named requirement is exempt Returns a list of exemptions.
Search the structure for any occurrence of Modname.fname.
The PPX implementation: check that each required call is present.