View Source unused_macros (rebar3_hank v1.4.1)
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.
note
Note
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.
Link to this section Summary
Functions
Rule ignore specifications. Example:
-hank([{unused_macros,
["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()
]},
Link to this section Functions
-spec ignored(hank_rule:ignore_pattern(), term()) -> boolean().
-hank([{unused_macros,
["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()
]},