Credence.Semantic.Rule behaviour
(credence v0.4.3)
Copy Markdown
Behaviour for semantic-level rules that fix compiler warnings.
Each rule matches specific compiler diagnostics and applies targeted fixes.
Diagnostics come from Code.with_diagnostics/1 and have the shape:
%{message: String.t(), position: {line, col} | line, severity: :warning | :error}
Summary
Callbacks
Fix the source for the given diagnostic. Returns modified source.
Does this rule handle the given diagnostic?
Convert a matched diagnostic to a Credence issue.
Types
Callbacks
@callback fix(source :: String.t(), diagnostic()) :: String.t()
Fix the source for the given diagnostic. Returns modified source.
@callback match?(diagnostic()) :: boolean()
Does this rule handle the given diagnostic?
@callback priority() :: integer()
@callback to_issue(diagnostic()) :: Credence.Issue.t()
Convert a matched diagnostic to a Credence issue.