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

Donovan
Hello everyone, I’m so glad to have discovered this awesome community. Thanks for creating it! This is my second post, and apologies for...
New
WildYorkies
It seems that the more I read, the more I find Elixir users speaking about all the ways that Elixir is not good for x, y, and z use cases...
New
cvkmohan
The upcoming Phoenix 1.6 release looks very interesting. Became a habit to watch the commits - and - what they are bringing in. phx.gen...
New
laiboonh
Hi all, I am trying to convince my team to use liveview over the current react. What are some of the points where one should consider us...
New
crabonature
I’m still quite new to Elixir. As I understand we got in Elixir “multi guards” as convention to simplify one large guard with or’s?: de...
New
AlexMcConnell
The reason that Rails is as popular as it is is because it’s very easy for relatively inexperienced developers to get a lot of work done....
588 19675 166
New
marciol
Please, let me know if this kind of discussion already took place in another topic . Hi all, how do you consider if is better to build ...
New
hazardfn
I suppose this question is effectively hackney vs. ibrowse but we are at a point in our project where we have to make a choice between th...
New
100phlecs
Are there any downsides, like perf issues, to putting all functional components in CoreComponents as long as you prefix it with the conte...
New
griffinbyatt
Sobelow Sobelow is a security-focused static analysis tool for the Phoenix framework. For security researchers, it is a useful tool for g...
New

Other popular topics Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

We're in Beta

About us Mission Statement