Closed acw224 closed 3 years ago
We've communicated by e-mail before on this. In short, we think this is a good idea and something that does indeed need fixing, and greatly appreciate the PRs.
The one bit we're not sure of is the division of responsibility between Relx and Rebar3 in terms of policies and components. The one bit we think needs changing is that we're passing the warning through the Relx state, which sort of piggy-backs on implementation details.
What we think should happen instead is this:
fun(_) -> true end
if unspecifiedfun(Warn) -> YourCode end
and set it in the relx state. You should use a closure to carry whatever rebar3 state you need without relx knowing a thing about the detailsDo you think this make sense? It sounds like it shouldn't be too much of a rewrite since many of the components can be kept and shifted around instead.
Thanks for the feedback.
I was able to carry the required modifications pretty easily, except for one little detail. The method filter_xref_results in rebar3 https://github.com/erlang/rebar3/blob/3169392c7d73e6b849fb3117fb76177478c85f38/src/rebar_prv_xref.erl#L183 is a bit more involved than being just a predicate on list.
Therefore, I found it a bit easier to pass the whole filter method as a fun(list()) -> list(), which default to the identity.
On Relx side https://github.com/erlware/relx/pull/882 On rebar3 side https://github.com/erlang/rebar3/pull/2611
Resolved on the relx side in #882
relx calls xref in rlx_assemble.erl
This one should honour the -xref_ignores from rebar3, and the ones defined at the module level (-ignore_xref(..)).
One way to do it is to have move the code: https://github.com/erlang/rebar3/blob/master/src/rebar_prv_xref.erl#L147 from rebar to relx.
Another way is to prevent relx from printing xref warning: https://github.com/erlware/relx/blob/master/src/rlx_assemble.erl#L737 and instead pass them to the rebar3 plugin, who can then use the code in rebar_prv_xref.erl as a dependency.
What do you think ?