AdRoll / rebar3_hank

The Erlang Dead Code Cleaner
MIT License
68 stars 9 forks source link

Ignore Specific Items #68

Closed elbrujohalcon closed 3 years ago

elbrujohalcon commented 3 years ago

I would like to be able to ignore some particular instances of a warning and not the whole module. In particular, I would like to be able to ignore some particular macros for single_use_macros or some particular functions (or even arguments) for unused_ignored_function_params.

I'm not sure how this configuration would work, maybe hank_rule:result() should include an id field that we can pattern-match for ignoring (unused_ignored_function_params ids could be {Module, Function, Position} while the ones for unused_macros could be {Module, MacroName} and so on…).

pbrudnick commented 3 years ago

Ignoring specific rules for specific functions would be a good feature. That's a simple approach, I was thinking more a "config" one, similar to xref, it would add a bit more logic but easier to add/remove ignore rules:

-ignore_hank({unused_ignored_function_params, {?MODULE, my_fun, 3}}).
-ignore_hank({single_use_macros, {?MODULE, ?MY_MACRO}}).
diegomanuel commented 3 years ago

More details about its implementation at PR: https://github.com/AdRoll/rebar3_hank/pull/83