Empty line causes: ** (Mix) mix format failed due to --check-formatted

I use Elixir 1.15.7 OTP 26 both in development (Windows) and on a GitHub runner (ubuntu-latest).

The GH Action fails on: mix format --check-formatted.

         |
 46  46  |          name
 47  47  |          organizationId
 48     -|  
     48 +|
 49  49  |          ... on Comment {
 50  50  |            text
         |

The code looks like this:

  @query """
  mutation ($organizationId: ID!, $type: ArticlesType!, $names: [String!]!) {
    createArticles(organizationId: $organizationId, type: $type, names: $names) {
      __typename
      ... on CreateArticlesSuccess {
        articles {
          __typename
          name
          organizationId
  
          ... on Comment {
            text
          }
        }
      }
    }
  }
  """

It seems that the fail is due to an empty line, but when I run the exact same command in development mix format --check-formatted there are no changes.

Any idea why this happens?

C:\data\projects\foo>elixir --version
Erlang/OTP 26 [erts-14.1.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit:ns]

Elixir 1.15.7 (compiled with Erlang/OTP 26)

GH Actions config:

    runs-on: ubuntu-latest
    name: Test on OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
    strategy:
      # Specify the OTP and Elixir versions to use when building
      # and running the workflow steps.
      matrix:
        otp: ['26.0']       # Define the OTP version [required]
        elixir: ['1.15.7']    # Define the elixir version [required]
1 Like

If you don’t have trailing white space in that line it may be an issue with line endings. I will play with it.

empty

there probably is a bunch of white space here

Yeah, I was able to reproduce it. Elixir is not warning on trailing whitespace if there are \r\n line endings, but it warns on Unix. Removing the trailing whitespace works on both but we should also warn on both. I will work on a fix.

5 Likes
5 Likes