elixir: Fix mix linter and support warnings#5140
Open
toupeira wants to merge 2 commits into
Open
Conversation
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
The error parsing stopped working at some point, probably when Elixir introduced its new error formatting in for 1.16 in 2023.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
I recently picked up Elixir again and noticed that the
mixlinter 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 helpto 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 runningmix help😀