package dunolint

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

Module Dunolint_engineSource

Sourcemodule Config : sig ... end
Sourcetype t

Execution control

Sourcemodule Visitor_decision : sig ... end

While we visit the repository, we may decide what to do at each step of the iteration.

parent_dir contains the complete relative path to the cwd from which the command originated, which should be assumed is the root of the repository.

subdirectories and files are the base names of the contents of the parent directory currently being visited.

If you want to visit only a subtree of the repository, you may provide below, which must be a relative path to a subdirectory of the cwd provided for creating t.

Lint

Sourceval lint_file : ?autoformat_file:(new_contents:Base.string -> Base.string) -> ?create_file:(Base.unit -> Base.string) -> ?rewrite_file:(previous_contents:Base.string -> Base.string) -> t -> path:Fpath_base.Relative_path.t -> Base.unit
Sourceval format_dune_file : t -> new_contents:Base.string -> Base.string

Spawn a dune format-dune-file on the new linted contents before materializing into a file. Exposed if you need to write your own linters on files that are supported by the formatter shipped with dune.

Sourceval run : config:Config.t -> (t -> 'a) -> 'a

This calls f once, registers all requests enqueued during the execution of f, and then depending on the config, either do a dry-run, or actually perform the desired transformations.

The intended use is for f to contain one or several calls to a function that uses t to perform some dunolint linting, such as visit, lint_dune_file, etc.

The process_mgr argument is used in order to spawn dune format-dune-file processes to reformat dune files after they have been linted.

In addition to enqueuing debug messages and errors, this function outputs messages regarding I/O actions executed during linting. These messages are produced onto stdout.

Step by step API

Sourceval create : config:Config.t -> t
Sourceval materialize : t -> Base.unit

Apply all the changes that have been saved into t to the file system, or merely print them if we're in dry-run mode.

OCaml

Innovation. Community. Security.