package dunolint

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

Module Dunolinter.Sexp_handlerSource

A handler for fields found in a dune stanza (in files "dune", "dune-project", etc.)

Such field is typically identified by its name, and then it is immediately followed by a variable number of arguments.

For example:

(name dunolint)
(libraries base sexps-rewriter)

A field starts with an atom (the field name), and the arguments are in a list of sexps.

By that definition, a stanza is a field itself, and its subfields just as well.

Sourcemodule type S = sig ... end
Sourcemodule Make_atom (_ : sig ... end) : S with type t = Base.string

A util to create a handler for an atom field, that is one that expects exactly one required argument that is an Sexp.Atom.

Sourcemodule Make_sexps (_ : sig ... end) : S with type t = Base.Sexp.t Base.list

A util to create a generic field handler that doesn't try to parse its arguments.

Sourcemodule Make_sexpable (_ : sig ... end) (M : Base.Sexpable.S) : S with type t = M.t

A util to create a handler from a sexpable type. The handler will expect exactly one value, which will be parsed and written (or replaced) according to the sexp serializer provided.

Utils

Sourceval find : (module S with type t = 'a) -> sexps_rewriter:Sexps_rewriter.t -> fields:Base.Sexp.t Base.list -> 'a Base.option

A convenient wrapper for read that finds the field to read from a list of fields embedded within a containing list of fields. The first field with the expected name is chosen and then we call read on it.

Sourceval get_args : field_name:Base.string -> sexps_rewriter:Sexps_rewriter.t -> field:Base.Sexp.t -> Base.Sexp.t Base.list

Destruct the given field and verify it has the correct field name. Return the args then. If the field doesn't have the right shape, and error is raised, using a location found via sexps_rewriter.

Sourceval insert_new_fields : sexps_rewriter:Sexps_rewriter.t -> indicative_field_ordering:Base.string Base.list -> fields:Base.Sexp.t Base.list -> new_fields:Base.Sexp.t Base.list -> Base.unit

During a dunolint lint, insert all fields found in new_fields that are not present in the existing fields. For those that are already present, it will be necessary to merge them with the expected value, see the rewrite functions of the module that corresponds to that particular field. For example: Dune_linter.Library.rewrite.

OCaml

Innovation. Community. Security.