xref

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

xref

Technion

Hi,


I'm wondering if I could get some advise regarding xref.

I've found across a number of projects, anything using Cowboy triggers similar alerts for me to below:


$./rebar3  xref

===> Warning: api_handler:init/2 is unused export (Xref)


The init/2 function is most definitely used - it's the Cowboy callback used exactly the same way as the demo echo server does here:

https://github.com/ninenines/cowboy/blob/master/examples/echo_get/src/toppage_handler.erl


I'm hoping to incorporate the xref test into my CI workflow, but I'd need to understand first how to convince it that Cowboy functions are not "unused". Is this a bug in xref or rebar?



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: xref

Guilherme Andrade


On 4 January 2018 at 04:46, Technion <[hidden email]> wrote:

I'm wondering if I could get some advise regarding xref.

I've found across a number of projects, anything using Cowboy triggers similar alerts for me to below:


I believe the example module you mentioned ('toppage_handler') implements the 'cowboy_handler' behaviour[1].

If '-behaviour(cowboy_handler).' were to be explicitly declared on 'toppage_handler', xref would realize that those unused functions are actually callbacks.


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: xref

Technion

Indeed that is correct. Many thanks for this.


From: Guilherme Andrade <[hidden email]>
Sent: Friday, 5 January 2018 12:39:24 AM
To: Technion
Cc: [hidden email]
Subject: Re: [erlang-questions] xref
 


On 4 January 2018 at 04:46, Technion <[hidden email]> wrote:

I'm wondering if I could get some advise regarding xref.

I've found across a number of projects, anything using Cowboy triggers similar alerts for me to below:


I believe the example module you mentioned ('toppage_handler') implements the 'cowboy_handler' behaviour[1].

If '-behaviour(cowboy_handler).' were to be explicitly declared on 'toppage_handler', xref would realize that those unused functions are actually callbacks.


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions