diff options
author | Daniel Luna <daniel@lunas.se> | 2012-09-13 16:07:18 -0400 |
---|---|---|
committer | Tuncer Ayaz <tuncer.ayaz@gmail.com> | 2012-09-13 22:20:55 +0200 |
commit | 7bd318c219bc283d5df16a0401aae00546fc8eea (patch) | |
tree | 0e40855d4efca5cb3a58b01a3de49c4dcd86b77a /src | |
parent | eaad535e316c7719babe42faa011a08e1e8675cb (diff) |
xref: allow multiple behaviours and ignore_xref pragmas
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_xref.erl | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/rebar_xref.erl b/src/rebar_xref.erl index 4b045a0..84b59f6 100644 --- a/src/rebar_xref.erl +++ b/src/rebar_xref.erl @@ -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; |