Module unused_callbacks

A rule to detect unused callbacks.

Behaviours: hank_rule.

To do

Description

A rule to detect unused callbacks.

This rule will check all callbacks defined in a module and find those that are not used anywhere in the module itself.

It will emit a warning if it can't find the callback's atom name being used anywhere within a module. It will NOT emit a warning if an atom named as a callback is being used, no matter for what that atom is used.

This limitation is due to the fact that there are many ways to call a function in Erlang (particularly when dynamic calls are involved).

The assumption is that if you define a callback for a behavior, your generic module (where the callback is defined) should call that function at some point, using the implementation provided by the specific module (the one that implements the behavior).

To avoid this warning, remove the unused callback definition.

Function Index

ignored/2Rule ignore specifications.

Function Details

ignored/2

ignored(Pattern::hank_rule:ignore_pattern(), Callback::term()) -> boolean()

Rule ignore specifications. Example:

       -hank([{unused_callbacks,
               [all, %% Will ignore all versions of the all callback (i.e. any arity)
                {just, 1} %% Will ignore just(term()) but not just() nor just(_, _) callbacks
               ]},
       


Generated by EDoc