Skip to content

elixir: Fix mix linter and support warnings#5140

Open
toupeira wants to merge 2 commits into
dense-analysis:masterfrom
toupeira:fix/elixir-mix
Open

elixir: Fix mix linter and support warnings#5140
toupeira wants to merge 2 commits into
dense-analysis:masterfrom
toupeira:fix/elixir-mix

Conversation

@toupeira

Copy link
Copy Markdown

Summary

I recently picked up Elixir again and noticed that the mix linter doesn't work at all, and triggers heavy compilations (see #3816 which should be fixed by this PR, except on the very first run in a big project I guess).

Tested with Elixir 1.20.0, more details in the commit messages.

Question

I also noticed that most of the other Elixir linters call mix help to check availability (e.g. mix help credo), which is pretty slow too (takes around 1s with a Phoenix project on this potato here).

I just set g:ale_linters = {'elixir': ['mix']} to avoid that, but I wonder if they should be disabled by default and let users opt-in? I'll probably start using one of them soon actually, and would rather avoid the repeated overhead of running mix help 😀

The mix linter sets `MIX_BUILD_PATH` to a temporary directory on every
run, which is very slow and inefficient. We can just use the default
build path to speed this up.

The default directory is `_build` inside the project, this is also
automatically added to `.gitignore` by `mix new` so hopefully shouldn't
cause any unwanted clutter.

The `%s` argument is removed since `mix compile` doesn't actually
support passing a filename.

The output stream is changed to `stderr` since that's where the errors
appear.

Other options:
- `mix compile` has a `--no-compile` flag, but this misses most errors
  including basic syntax errors
- `mix format` has a `--dry-run` flag, but this only catches basic
  syntax errors and misses other errors like undefined functions

Fixes dense-analysis#3816
@toupeira toupeira requested a review from w0rp as a code owner June 11, 2026 23:21
The error parsing stopped working at some point, probably when Elixir
introduced its new error formatting in for 1.16 in 2023.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant