Fl4m3Ph03n1x

Fl4m3Ph03n1x

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 !

Showing Posts 1 to 7

hauleth

hauleth

mix xref was useful not only for finding unreachable code, it also supported looking for all callers or generating dependency graph of the application. So none of these functionalities was available during compilation.

Fl4m3Ph03n1x

Fl4m3Ph03n1x OP

But do you use it on a daily basis?

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.

hauleth

hauleth

Do you use dbg module on daily basis? Do you use mix profile.* on daily basis? No, these tools have specific use cases, and when you need them you praise all J’s that decided that it should be part of the default release instead of spending X hours on searching solutions that will work.

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
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.

lawik

lawik

Nerves Core Team

Saw the command thanks to the coming changes and ended up needing mix xref callers MyModule.function/1 to refactor things in a client project.

— All posts loaded —

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 92995 915
New
caslu
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
GES233
I’m posting this in response to Jose’s recent tweet (Cr. link) : People are sleeping on Elixir for a coding harness: Hot-code swappi...
New
_mfierro
Hello, I wrote Stop My Hand, a Scattergories-like web application using Phoenix/LiveView as my learning project for Elixir (after readin...
New
marciol
It would be helpful to have a list of companies worldwide that hire engineers without prior experience in Elixir. Often, it can be quite ...
New
durvia
Anyone running long-lived stateful processes on BEAM? We’re building an AI agent runtime and would love to compare notes. We’re a small ...
New

Other Trending Topics Top

garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews