Did mix format changed with Elixir 1.12?

I’ve updated my project to build with Elixir 1.11 and 1.12 and I use ex_check to run standards checks (unit tests, format, doc, credo…)

My build now fails on formating (see that change I had to make for Elixir 1.12): Elixir 1.11 and 1.12 expect different things now.

Has anyone encountered this? How can I make my build run under Elixir 1.11 and 1.12?

(as I also use elixir_git_hooks local commits and pushes are now an issue on my local machine)

Yes, it did. Here’s the relevant part from the release notes:

  • [Code] Do not add newlines around interpolation on code formatting. Note this means formatted code that has interpolation after the line length on Elixir v1.12 won’t be considered as formatted on earlier Elixir versions
1 Like

The only solution I see for my CI build is to make different workflows depending on Elixir version (only unit tests on elixir 1.11 and all checks on elixir 1.12)

Sorry for potentially ignorant question, but couldn’t you just format the code and commit that alongside the Elixir version bump?

I’d like to have compatible code with the 2 versions

You can use concatenation instead of interpolation then.

That’s what we do in our projects and seems to work well:

          - pair:
              elixir: 1.5.3
          - pair:
              elixir: 1.11.4
              otp: 23.3.2
            lint: lint
# ...
      - run: mix format --check-formatted
        if: ${{ matrix.lint }}