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_prioritySets the checks’s base priority (:low,:normal,:high,:higheror:ignore).:categorySets the check’s category.:elixir_versionSets the check’s version requirement for Elixir (defaults to>= 0.0.1).:run_on_allSets 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:
:prioritySets the issue’s priority.:triggerSets the issue’s trigger.:line_noSets the issue’s line number. Tries to findcolumnif:triggeris supplied.:columnSets the issue’s column.:exit_statusSets the issue’s exit_status.:severitySets 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()