Fl4m3Ph03n1x

Fl4m3Ph03n1x

Does anyone use Mix xref?

Background

Recently I found out aboubt mix xref, which according to my understanding analyses the code for unreachable paths and deprecated functions.

Questions

It looks really nice, but I have some questions:

  • Isn’t this already part of the mix compile task that runs automatically every time you execute a non-compiled project?
  • In which scenarios do I have to manually run this command?
  • Do you guys use it in your CIs ?

Please let me know your answers !

Most Liked

dimitarvp

dimitarvp

I’m currently using mix xref callers MyApp.Schema – a module namespace that contains all my DB (Ecto) code. I’m integrating it in a GIT pre-commit hook that checks which modules use that namespace because I only want certain modules to directly use DB code.

So that’s one valid usage: you can enforce some limitations on your project at GIT pre-commit or CI server level. You can call it homemade linting.

Another very good usage is refactoring. When you move functions around – or rename them, or delete them – you want to minimise compilation or runtime errors so you first search who calls them and rework those as well along the way.

webuhu

webuhu

I was using mix xref within CI.

In detail:

  • mix xref unreachable --abort-if-any
  • mix xref deprecated --abort-if-any

But as with Elixir v1.10 these checks will move into the compiler.
I will use instead:

  • mix compile --warnings-as-errors
NobbZ

NobbZ

Do you use mix test --stale? If yes, you are using mix xref more than you might know that you use it.

Similar if you use the ElixirLS. It builds upon xrefs result asas well.

Where Next?

Popular in Discussions Top

PragTob
Hello everyone, I know we had quite some threads (read through lots of them) about background job processing but it remains a hotly deba...
New
blackode
Elixir Upgrading is so Simple in Ubuntu and It worked for me Ubuntu 16.04 git clone https://github.com/elixir-lang/elixir.git cd elixir...
New
sashaafm
I’m trying to evaluate the best combo/stack for a BEAM Web app. Right now I’m exploring Yaws a bit, after having dealt with Phoenix for a...
New
mmport80
I have put far too much effort into Dialyzer over the last year or so - and basically - I doubt it’s worth the effort. It’s not as easy ...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
jer
I’ve been using umbrellas for a while, and generally started off (on greenfield projects at least) by isolating subapps based on clearly ...
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
chulkilee
Here are the list of HTTP client libraries/wrappers, and some thoughts on HTTP client in general. I’d like to hear from others how they w...
New
axelson
Decided against including more info in the title, but the gist is that Plataformatec sponsored projects will continue with the assets bei...
New
kostonstyle
Hi all How can I compare haskell with elixir, included tools, webservices, ect. Thanks
New

Other popular topics Top

WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36432 110
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54250 245
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement