Module unused_macros

A rule to detect unused macros.

Behaviours: hank_rule.

To do


A rule to detect unused macros.

To avoid this warning, remove the unused macros.

Note that for header files, this rule will fail to detect some unused macros. Particularly, in the case where you have an unused macro defined in a header file and another macro with the same name and arity defined somewhere else that is used. Since determining precisely what files are included in each -include attribute is not trivial, Hank will act conservatively and not make any effort to verify where each macro that's used is defined. So, if you have a project with multiple definitions of the same macro with the same arity... well... as long as one of them is used, none of them will be reported as unused.


This rule assumes that hrl files will not be used outside your project. If you are writing a library that requires your clients to use a macro defined in some of your header files, you can add an ignore rule in rebar.config for it.

Function Index

ignored/2Rule ignore specifications.

Function Details


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

Rule ignore specifications. Example:

               ["ALL", %% Will ignore ?ALL, ?ALL() and ?ALL(X)
                {"ZERO", 0}, %% Will ignore ?ZERO() but not ?ZERO(X) nor ?ZERO
                {"ONE",  1}, %% Will ignore ?ONE(X) but not ?ONE()   nor ?ONE
                {"NONE", none} %% Will ignore ?NONE but not ?NONE(X) nor ?NONE()

Generated by EDoc