hank_rule behaviour (rebar3_hank v2.0.0)
View SourceBehavior for defining a rule for Hank.
Summary
Functions
Analyze the given files with the rule.
The list of default rules to apply.
Check if given rule should be ignored from results.
Types
-type asts() :: [{file:filename(), erl_syntax:forms()}].
-type ignore_pattern() :: undefined | tuple().
-type ignore_spec() :: {file:filename(), t() | all} | {file:filename(), t(), term()}.
-type result() :: #{file := file:filename(), line := non_neg_integer(), text := iodata(), rule => t(), pattern => ignore_pattern()}.
-type t() :: module().
Callbacks
-callback analyze(asts(), hank_context:t()) -> [result()].
-callback ignored(ignore_pattern(), term()) -> boolean().
Functions
-spec analyze(t(), asts(), hank_context:t()) -> [result()].
Analyze the given files with the rule.
-spec default_rules() -> [].
The list of default rules to apply.
-spec is_ignored(t(), ignore_pattern(), all | term()) -> boolean().
Check if given rule should be ignored from results.