Credo v1.2.3 Credo.Check behaviour View Source
Check
modules represent the checks which are run during Credo’s analysis.
Example:
defmodule MyCheck do
use Credo.Check, category: :warning, base_priority: :high
def run(source_file, params) do
#
end
end
The check can be configured by passing the following
options to use Credo.Check
:
:base_priority
Sets the checks’s base priority (:low
,:normal
,:high
,:higher
or:ignore
).:category
Sets the check’s category.:elixir_version
Sets the check’s version requirement for Elixir (defaults to>= 0.0.1
).:run_on_all
Sets whether the check runs on all source files at once or each source file separatly.
The run/2
function of a Check module takes two parameters: a source file and a list of parameters for the check.
It has to return a list of found issues.
Link to this section Summary
Functions
format_issue takes an issue_meta and returns an issue.
The resulting issue can be made more explicit by passing the following
options to format_issue/2
Converts a given category to an exit status
Link to this section Functions
format_issue takes an issue_meta and returns an issue.
The resulting issue can be made more explicit by passing the following
options to format_issue/2
:
:priority
Sets the issue’s priority.:trigger
Sets the issue’s trigger.:line_no
Sets the issue’s line number. Tries to findcolumn
if:trigger
is supplied.:column
Sets the issue’s column.:exit_status
Sets the issue’s exit_status.:severity
Sets the issue’s severity.
Converts a given category to an exit status
Link to this section Callbacks
Returns the base priority for the check.
Returns the category for the check.
format_issue(issue_meta :: Credo.IssueMeta.t(), opts :: Keyword.t()) :: Credo.Issue.t()