Settings.Validation (fnord v0.9.29)
View SourceReads and normalizes project-scoped validation settings.
Validation rules live under a project's validation key in settings.json.
Each rule maps one or more project-relative path globs to a command string
that should be executed when matching files change.
Summary
Functions
Adds a normalized validation rule to the currently selected project so the active project's validation command set includes another file-matching rule.
Adds a normalized validation rule to the named project as part of managing the project's persisted validation rule set.
Clears all validation rules for the currently selected project, resetting the active project's validation rule set.
Clears all validation rules for the named project by replacing its persisted validation rules with an empty list.
Returns true when the current project has at least one valid validation rule.
Returns true when the named project has at least one valid validation rule.
Returns the normalized validation rules for the currently selected project.
Returns the normalized validation rules for the named project.
Removes the validation rule at the given 1-based index from the currently selected project so the active project's validation rule set no longer includes that entry.
Removes the validation rule at the given 1-based index from the named project as part of maintaining its persisted validation rules.
Types
Functions
@spec add_rule(String.t(), String.t() | [String.t()]) :: {:ok, [rule()]} | {:error, :invalid_rule | :project_not_set}
Adds a normalized validation rule to the currently selected project so the active project's validation command set includes another file-matching rule.
@spec add_rule(String.t(), String.t(), String.t() | [String.t()]) :: {:ok, [rule()]} | {:error, :invalid_rule | :project_not_found}
Adds a normalized validation rule to the named project as part of managing the project's persisted validation rule set.
@spec clear() :: :ok | {:error, :project_not_found}
Clears all validation rules for the currently selected project, resetting the active project's validation rule set.
@spec clear(String.t()) :: :ok | {:error, :project_not_found}
Clears all validation rules for the named project by replacing its persisted validation rules with an empty list.
@spec configured?() :: boolean()
Returns true when the current project has at least one valid validation rule.
Returns true when the named project has at least one valid validation rule.
@spec list() :: [rule()]
Returns the normalized validation rules for the currently selected project.
Returns the normalized validation rules for the named project.
@spec remove_rule(integer()) :: {:ok, [rule()]} | {:error, :invalid_index | :project_not_set | :project_not_found}
Removes the validation rule at the given 1-based index from the currently selected project so the active project's validation rule set no longer includes that entry.
@spec remove_rule(String.t(), integer()) :: {:ok, [rule()]} | {:error, :invalid_index | :project_not_found}
Removes the validation rule at the given 1-based index from the named project as part of maintaining its persisted validation rules.