package dunolint

  1. Overview
  2. Docs
On This Page
  1. Helpers
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Dunolinter.LinterSource

Sourcemodule type S = sig ... end
Sourcetype t =
  1. | Unhandled
  2. | T : {
    1. eval : path:Fpath_sexp0.Relative_path.t -> predicate:Dunolint.Predicate.t -> Dunolint.Trilang.t;
    2. enforce : path:Fpath_sexp0.Relative_path.t -> condition:Dunolint.Predicate.t Dunolint.Std.Blang.t -> Base.unit;
    } -> t

Helpers

Sourcemodule Predicate : sig ... end
Sourceval enforce : (module Handler.Predicate with type t = 'predicate) -> eval:('t -> predicate:'predicate -> Dunolint.Trilang.t) -> enforce:('t -> 'predicate Predicate.t -> Enforce_result.t) -> 't -> condition:'predicate Dunolint.Std.Blang.t -> Base.unit

A helper function that can be useful to implement the enforce function required by the Linter.S interface.

Sourceval find_init_value : 'a Dunolint.Std.Blang.t -> f:('a -> 'b Base.option) -> 'b Base.option

Search for an initial value that can be used to initialize an absent field.

Only predicates at positive enforcing positions (Base and And) are considered. The function f should return Some value for predicates that can provide a concrete initial value (like equals), and None for predicates that cannot (like is_prefix or is_suffix).

Returns the first matching value found, or None if no predicate can provide an initial value.

Sourceval public_name_is_prefix : Base.string -> prefix:Base.string -> Base.string

A helper that applies some usually helpful heuristic when proposing a new name based on the `is_prefix predicate. Assumed to be called when the given prefix is not already a prefix of the input, otherwise the output is unspecified.