Skip to content

Mix Formatter not compiling plugins #11915

@TheFirstAvenger

Description

@TheFirstAvenger

Elixir and Erlang/OTP versions

Erlang/OTP 24 [erts-12.2.1] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1]
Elixir 1.13.4 (compiled with Erlang/OTP 23)

Operating system

Github Actions CI

Current behavior

We recently had an issue where we had configured the HTMLFormatter as a plugin in .formatter.exs and it was failing silently in CI.

There are two underlying issues here:

  1. When a plugin defined in .formatter.exs is not found, mix format outputs Skipping formatter plugin Phoenix.LiveView.HTMLFormatter because module cannot be found but does not return an error code. This is a problem in CI where the output isn't generally reviewed, only error returns.

  2. mix format does not compile the application being formatted or its dependencies. This was ok before plugins, but when a plugin is involved, especially if that plugin is not yet compiled, this is a problem.

The combination of these two potentially leaves users in the state of having a Github Actions CI job that performs a checkout and then a mix format, which runs without compiling, and then "silently" failed to use the desired plugin.

Expected behavior

  1. mix format should fail if a plugin is not found
  2. mix format should compile the app when a plugin is defined in .formatter.exs (maybe only when it is not found?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions