phewitt

phewitt

I want to know how to suppress errors in elixir. Ideally a few ways. Fixing them is not an option. We are slowly fixing them.

I’m currently working in a 7 year old umbrella project with many thousands of warnings, thousands of files. I’ve tried both our current elixir 1.15.6-otp-26 and elixir 1.16.0-otp-26. Which the newer version does have nicer looking errors, but is still not what i’m looking for. I’m wanting to optionally suppress the warnings when running tests or trying to identify compile errors locally. Ideally with a flag or shell var so that I can keep it enabled for ElixirLS.

The main motivation behind this is that the REAL errors get drowned in the sea of warnings. I literally have to use the search feature within my terminal to try and find the error. However, even this is terrible because a lot of the warnings include err or error which makes searching difficult.

I feel like in previous versions (i think ~1.14) of elixir the errors would short circuit compilation which at least left the error at the bottom of the output instead of hidden in the middle.

Given this context the best solution I can think of is leveraging compiler flags to minimize or suppress the warnings explicitly when running tests / iex locally. I’ve found a few things that seem like they may help, but I don’t know how to actually enable them / pass them to the erlang compiler.

Things i’ve sort of found, but have not figured out how to use correctly. A couple things i’ve looked at…

  1. erlang compiler options, report_warnings , things like nowarn_unused_vars

    • if this is the right thing. how can I actually leverage it in elixir. I’ve looked at
      ERL_COMPILER_OPTIONS, but can’t seem to get it do do anything.
  2. @compile :nowarn_unused_vars attribute in a module that generates warnings.

    • This seemed to have no impact…
  3. Mix compile options, --no-all-warnings. I don’t think this is even what i’m looking for but I tried it. or any compile option that might help…

  4. My coworker literally has a script to grep through the output to help filter down to the errors. I would hate for this to be our only solution…

External links that are related.

What’s blown my mind the most about this is that I feel nearly alone looking at a solution to this. I feel configuring the output of a compiler is a pretty important thing.

Anyhow, hope someone can help! Until then i’ll continue my trash workflow of swimming through warnings.

Thank You!

Showing Posts 1 to 10

TwistingTwists

TwistingTwists

+1 . Me facing same stuff.

LostKobrakai

LostKobrakai

It wasn’t a short circuit, but afaik some changes in ordering of IO. But indeed that changed at some point.

There’s explicitly no way to do that afaik. It’s not a nobody is interested in this, but iirc an active choice made by the core team to not have a setting for that.

sodapopcan

sodapopcan

Out of curiosity, what are the warnings you are getting? I just ask as they could be easier to fix than you think, even on a huge project, using Sourceror.

phewitt

phewitt OP

I hope that’s not the case. I understand discouraging it, but why explicitly restrict it? What’s the benefit? Erlang seems to have the option to do it! I wonder if anyone has some forked elixir that I could just use locally. I wouldn’t know where to begin to patching it myself.

phewitt

phewitt OP

I appreciate the reply, but my goal is to avoid this sentiment and style of answer. I’m aware that everyone believes “fixing” the warnings is the correct way, and in a vacuum I agree. I’m also aware there are many ways to scan/update the source programatically. However, This is a higher risk operation that is less than ideal for our large prod codebase. Making huge sweeping changes across the entire codebase (even if trivial) is not something we want to do. In the log run we are working and chipping them away.

I do not need help understanding the fix for any particular warning type… they all make sense. They are not an explicit PROBLEM for us in our system. And some are even expected… There are many types, and it would take me some time to actually figure out comprehensively all of them but to list a few just for you…

  1. module X is not available or is yet to be defined
  2. variable "X" is unused. there is a variable with the same name in the context, use the pin operator (^) to match on it or prefix this variable with underscore if it is not meant to be used
  3. X is deprecated. Use Y instead
  4. def my_fake_func/1 has multiple clauses and also declares default values
  5. unused alias Channel
  6. module attribute @Y was set but never used
  7. undefined module attribute @Y
  8. missing parentheses for expression following "do:" keyword. Parentheses are required to solve ambiguity inside keywords.

This is just a sample what I see scanning with my eyes and not comprehensive. There are literally thousands of warnings.

All responses around this idea seem to end up with the same answer. Something along the lines of “just fix the warning” or “the warnings are telling you something is likely wrong with your code”. I hear that and disagree that it’s ALWAYS the case. So, at least here, please respond with direct answers within the scope of my question regardless of how you feel about it. This is why I explicitly said “Fixing them is not an option”.

sodapopcan

sodapopcan

Yep, that’s why I said could and was very careful not to use the word “just” (I know we all love when people start a sentence with “Can’t ya just…”). Yes, some of these would be very tough to fix programmatically so it’s not much help to you here. But there are certain classes of warnings that are easy and safe to programmatically fix which is why I asked.

I’m not sure why there is no option to disable warnings. My guess is that it is generally a dangerous thing to do. Warnings give us important feedback during development. If you blanket turned-off warnings then you’ll stop getting new ones as you dev. I could see this bringing up a whole new slew of complaints. I could see turning off everything except for deprecation warnings being useful but ya, I’m also pretty sure there is no way to do this. Again, this is a guess, I’m not on the core team nor do I contribute to the language.

LostKobrakai

LostKobrakai

You’d likely need to take this up with the core team if you want to change that.

phewitt

phewitt OP

i’ll look into it. Thx. I wonder if we could simply have warnings in stdout and errors in stderr. and then I could easily filter them

phewitt

phewitt OP

I can’t post on that group. what’s the normal avenue to bring it to discussion with core team? I’de be interested in if they even think it’s hard. if it’s not hard i’ll happily fork elixir and use that locally…

LostKobrakai

LostKobrakai

The group is the place for elixir development discussions. I’ve posted there before without issues. Here might be seen by people as well. Github issue might be ok given the outlines issues you have as well, not sure about that one though.

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apz
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
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
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
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
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
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

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews