View Source Recode.Config (Recode v0.7.3)

Functions to read and merge the Recode configuration.

Summary

Functions

Returns the default configuration.

Merges two configs into one.

Reads the Recode cofiguration from the given path.

Returns the given config as a formatted string with comments.

Validates the config version and tasks.

Types

@type config() :: keyword()

Functions

@spec default() :: config()

Returns the default configuration.

Link to this function

merge(left \\ default(), right)

View Source
@spec merge(config(), config()) :: config()

Merges two configs into one.

The merge will do a deep merge. The merge will do a deep merge. The merge takes the version from the right config.

Examples

iex> new = [version: "0.0.2", verbose: false, autocorrect: true]
...> old = [version: "0.0.1", verbose: true]
iex> Recode.Config.merge(new ,old) |> Enum.sort()
[autocorrect: true, verbose: true, version: "0.0.2"]
Link to this function

read(path \\ ".recode.exs")

View Source
@spec read(Path.t()) :: {:ok, config()} | {:error, :not_found}

Reads the Recode cofiguration from the given path.

Link to this function

to_string(config \\ default())

View Source
@spec to_string(config()) :: String.t()

Returns the given config as a formatted string with comments.

@spec validate(config()) :: :ok | {:error, :out_of_date | :no_tasks}

Validates the config version and tasks.