View Source hank_rule behaviour (rebar3_hank v1.4.0)

Behavior for defining a rule for Hank.

Link to this section 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

Link to this section 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().

Link to this section Callbacks

-callback analyze(asts(), hank_context:t()) -> [result()].
-callback ignored(ignore_pattern(), term()) -> boolean().

Link to this section Functions

Link to this function

analyze(Rule, ASTs, Context)

View Source
-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
Link to this function

is_ignored(Rule, Pattern, IgnoreSpec)

View Source
-spec is_ignored(t(), ignore_pattern(), all | term()) -> boolean().
Check if given rule should be ignored from results