From 4deb6437f548a803509bce1ee87850c5501edc03 Mon Sep 17 00:00:00 2001 From: Bryan Paxton Date: Fri, 30 Nov 2018 20:06:42 -0600 Subject: Support ignoring whole modules in xref results - Added support to rebar_prv_xref for filtering out whole module. A module may now be added to the list of xref_ignores in rebar.config or via -ignore_xref() module attribute - Added unit test for whole module filtering support to xref CT suite --- src/rebar_prv_xref.erl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/rebar_prv_xref.erl b/src/rebar_prv_xref.erl index 12063d5..3c987b4 100644 --- a/src/rebar_prv_xref.erl +++ b/src/rebar_prv_xref.erl @@ -160,7 +160,8 @@ get_xref_ignorelist(Mod, XrefCheck) -> %% And create a flat {M,F,A} list lists:foldl( fun({F, A}, Acc) -> [{Mod,F,A} | Acc]; - ({M, F, A}, Acc) -> [{M,F,A} | Acc] + ({M, F, A}, Acc) -> [{M,F,A} | Acc]; + (M, Acc) when is_atom(M) -> [M | Acc] end, [], lists:flatten([IgnoreXref, BehaviourCallbacks])). keyall(Key, List) -> @@ -195,7 +196,8 @@ filter_xref_results(XrefCheck, XrefIgnores, XrefResults) -> end, SearchModules), [Result || Result <- XrefResults, - not lists:member(parse_xref_result(Result), Ignores)]. + not lists:member(element(1, Result), Ignores) + andalso not lists:member(parse_xref_result(Result), Ignores)]. display_results(XrefResults, QueryResults) -> [lists:map(fun display_xref_results_for_type/1, XrefResults), -- cgit v1.1