package dunolint
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=e4ca7c98db73dd9ab2ae8cba37ee0645f580267484e9893dbce6e28f4f2f0170
sha512=7ca658fb96139a0c41724355ac6aaf83d75468c7df14569b8f6090711f73a8fb2408ed1145384e756418682f0fa660a915842fd2b3f8b42e5ed4990e795b384e
doc/dunolint.dunolint_engine/Dunolint_engine/index.html
Module Dunolint_engine
Source
Execution control
While we visit the repository, we may decide what to do at each step of the iteration.
val visit :
?below:Fpath_base.Relative_path.t ->
t ->
f:
(parent_dir:Fpath_base.Relative_path.t ->
subdirectories:Base.string Base.list ->
files:Base.string Base.list ->
Visitor_decision.t) ->
Base.unit
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
val lint_dune_file :
?with_linter:(Dune_linter.t -> Base.unit) ->
t ->
path:Fpath_base.Relative_path.t ->
f:(Dune_linter.Stanza.t Dunolinter.Stanza.t -> Base.unit) ->
Base.unit
val lint_dune_project_file :
?with_linter:(Dune_project_linter.t -> Base.unit) ->
t ->
path:Fpath_base.Relative_path.t ->
f:(Dune_project_linter.Stanza.t Dunolinter.Stanza.t -> Base.unit) ->
Base.unit
val 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
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.
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
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.