UmbertoCorponi
Undefined module warnings for mix-compiled erlang code
Hi all!
I’m quite a new entry in the elixir community, and coming from erlang i found an issue integrating a mixed erlang/elixir codebase.
When i compile elixir code calling an non-existing module
defmodule Xxx do
def a() do
DoesNotExists.b()
end
end
a very useful warning is reported:
warning: DoesNotExists.b/0 is undefined (module DoesNotExists is not available or is yet to be defined)
This is very nice, since there is 99% chance of this being a typo.
I lately found out that mix is also more than happy to compile whatever src/*.erl files i have in my source tree, and this comes quite handy since i have to interact with a quite extensive codebase of libraries using erlang macro/record etc.
What i find odd is the fact that i don’t get the same kind of warning for the erlang code, so an erlang module like the following does not report anything wrong:
-module(xxx).
-export([a/0]).
a()->
doesnotexists:b().
It is also true that this is not a warning that the erlang compiler will report,
but when using rebar3 i can just call rebar3 xref to perform a fast check, without involving unit tests or dialyzer.
Apparently mix xref does not offer of the shelf a way to perform such checks on erlang code, or if it does it is not clear from the documentation.
Is there a way to perform such validation on the codebase or the only option is to implement a mix task mimicking the rebar3 xref command?
Thanks!
Popular in Questions
Other popular topics
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
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









