package dunolint
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=b44119c96aeabb960e852711c2f20ae43f0011e796f05e012141ba980a5b58f6
sha512=5bf76732adc940db6cac0875e94c3eaff436288faba95388b9675c68b3f30f5362e01f289fc8a096325f7db812ace273773a1e051ab7d7ace3b8db4a57a0e070
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
.