Behaviours: hank_rule.
To do
The rule will detect fields that are defined as part of a record but never actually used anywhere.
To avoid this warning, remove the unused record fields.
Note that for header files, this rule will fail to detect some unused fields. Particularly, in the case where you have an unused field defined in a header file and another record with the same name and the same field 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 record field that's used is defined. So, if you have a project with multiple definitions of the same record with the same field... well... as long as one of them is used, none of them will be reported as unused.
This rule assumes that your code will never use the underlying tuple structure of your records directly. If you do so, you can add an ignore rule in rebar.config for it.
ignored/2 | Rule ignore specifications. |
ignored(Pattern::hank_rule:ignore_pattern(), RecordName::term()) -> boolean()
Rule ignore specifications. Example:
-hank([{unused_record_fields, [a_record, %% Will ignore all fields in #a_record {a_record, a_field} %% Will ignore #a_record.a_field ]}]).
Generated by EDoc