UmbertoCorponi

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!

Where Next?

Popular in Questions Top

yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
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
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
idi527
I’ve been re-reading swift book again and noticed that multiline strings there don’t have a trailing line break, unlike in elixir iex(2)...
New

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1140 51847 244
New
William
I would like to know that is there any online source for learning Phoenix Framework for building E-Commerce Store? Any advantage on build...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New

We're in Beta

About us Mission Statement