mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 03:00:17 +00:00
xref: allow multiple behaviours and ignore_xref pragmas
This commit is contained in:
parent
eaad535e31
commit
7bd318c219
1 changed files with 6 additions and 12 deletions
|
@ -146,10 +146,10 @@ filter_away_ignored(UnusedExports) ->
|
|||
%% any functions marked to ignore. We then use this list to mask any
|
||||
%% functions marked as unused exports by xref
|
||||
F = fun(Mod) ->
|
||||
Attrs = kf(attributes, Mod:module_info()),
|
||||
Ignore = kf(ignore_xref, Attrs),
|
||||
Callbacks =
|
||||
[B:behaviour_info(callbacks) || B <- kf(behaviour, Attrs)],
|
||||
Attrs = Mod:module_info(attributes),
|
||||
Ignore = keyall(ignore_xref, Attrs),
|
||||
Callbacks = [B:behaviour_info(callbacks)
|
||||
|| B <- keyall(behaviour, Attrs)],
|
||||
[{Mod, F, A} || {F, A} <- Ignore ++ lists:flatten(Callbacks)]
|
||||
end,
|
||||
AttrIgnore =
|
||||
|
@ -157,14 +157,8 @@ filter_away_ignored(UnusedExports) ->
|
|||
lists:map(F, lists:usort([M || {M, _, _} <- UnusedExports]))),
|
||||
[X || X <- UnusedExports, not lists:member(X, AttrIgnore)].
|
||||
|
||||
|
||||
kf(Key, List) ->
|
||||
case lists:keyfind(Key, 1, List) of
|
||||
{Key, Value} ->
|
||||
Value;
|
||||
false ->
|
||||
[]
|
||||
end.
|
||||
keyall(Key, List) ->
|
||||
lists:flatmap(fun({K, L}) when Key =:= K -> L; (_) -> [] end, List).
|
||||
|
||||
display_mfas([], _Message) ->
|
||||
ok;
|
||||
|
|
Loading…
Reference in a new issue