Eqwalizer with rebar3 installing in the wrong place

When I follow the installation instructions at GitHub - WhatsApp/eqwalizer: A type-checker for Erlang, the plugin is installed to _build/default/plugins/eqwalizer_rebar3/eqwalizer_rebar3 (note the duplication), and then doesn’t appear in rebar3 plugins list or rebar3 help.

If I attempt to move the plugin files to the correct place, rebar3 just downloads a fresh copy to the wrong place.

Rebar3 does something similar with the eqwalizer_support dependency – it ends up in _build/default/lib/eqwalizer_support/eqwalizer_support/, though it does seem to fix up the code path when running rebar3 shell. It looks like there’s a bug of some kind in the way that plugins interact with git_subdir support.

Has anyone managed to get eqwalizer working with rebar3?

Huh, I’m looking at it from libraries I use that make this work (such as opentelemetry libs), and they appear to mostly use the checkouts when there is already an apps/ directory at the project root, and it seems Rebar3 somehow knows to recursively look these up.

I don’t even exactly understand how this would work for deps (maybe we rely on recursive source file lookup?) and it’s possible that this consequently would mess with plugins because they’re loaded up differently from regular modules?

I’ll ping @tsloughter on this for extra thinking.

They are in the right place. It uses a git feature to clone just what is needed and that places it in a subdirectory like that.

Rebar3 figures out the code path based on the dep definition so it knows to include that subdir when adding the code path.

Oh, but missing from list and help is a bug. But likely in their code and not where the deps are actually placed.

$ DEBUG=1 rebar3 plugins list
...
--- Local plugins ---
===> Unable to find plugin eqwalizer_rebar3

Ah. Looking at the plugin code, it actually advertises itself as build_info. If you run it, it spits out a big ol’ map of apps, deps, etc.

I wonder whether it’s intended to be used by the elp binary to … do something…? Or maybe it’s just not finished…?

Update: here’s the deal; eqwalizer is actually mostly driven by the elp binary, which lives at GitHub - WhatsApp/erlang-language-platform: Erlang Language Platform. LSP server and CLI..

It needs a way to figure out where the various bits of your project live; that’s provided by this build_info plugin. It’s related to this PR here: Initial version of the Manifest plugin (experimental) by robertoaloi · Pull Request #2859 · erlang/rebar3 · GitHub

I don’t know what the eqwalizer_support dependency does.

But: this plugin is mis-named. I expected it to add a rebar3 eqwalizer command.