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 compiletask 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 !
Trending in Discussions
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...
New
The obligatory hello world thread!
Who are you and where are you from? :stuck_out_tongue:
New
@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project.
My initial shotgu...
New
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
Just a general thread to post chat/news/info relating to AI/ML stuff that may be relevant for Nx now or in the future. Got anything to sh...
New
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
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
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
While I am working on the Language Agnostic Code Audit SaaS, which uses MetaAST (spoiler: I am expecting it to be in a good shape for ann...
New
Chat & Discussions>Discussions
Latest on Elixir Forum
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #phoenix_html
- #iex
- #graphql
- #ai
- #genstage
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex










First 7 of 7 Posts
hauleth
mix xrefwas 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
But do you use it on a daily basis?
NobbZ
Do you use
mix test --stale? If yes, you are usingmix xrefmore than you might know that you use it.Similar if you use the ElixirLS. It builds upon
xrefs result asas well.hauleth
Do you use
dbgmodule on daily basis? Do you usemix 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
I was using
mix xrefwithin CI.In detail:
mix xref unreachable --abort-if-anymix xref deprecated --abort-if-anyBut as with Elixir v1.10 these checks will move into the compiler.
I will use instead:
mix compile --warnings-as-errorsdimitarvp
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
Saw the command thanks to the coming changes and ended up needing
mix xref callers MyModule.function/1to refactor things in a client project.