Skip to content

mix format does not respect max line length #11194

@albertored

Description

@albertored

Environment

Erlang/OTP 23 [erts-11.2.2.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
Elixir 1.12.2 (compiled with Erlang/OTP 23)

Problem

mix format behaves differently in version 1.12.2 with respect with 1.10.4.

In .formatter.exs the line length is set to 120 and with elixir 1.10.4 this file is formatted as follows:

defmodule A do
  defp info(version, exclude) do
    %Info{
      title: "XXX",
      version: "1.2.3",
      description: """

      #{
        :app
        |> Application.fetch_env!(:doc_resources_changelog_path)
        |> read_or_empty_string()
        |> clean_tagged_string(exclude)
      }

      #{
        :app
        |> Application.fetch_env!(:doc_schema_version_path)
        |> read_or_empty_string()
        |> clean_lines_containing(exclude)
      }

      """
    }
  end
end

With elixir 1.12.2 it is instead formatted with the pipes on single lines despite they both exceed the maximum line length (129 and 127 chars)

defmodule A do
  defp info(version, exclude) do
    %Info{
      title: "XXX",
      version: "1.2.3",
      description: """

      #{:app |> Application.fetch_env!(:doc_resources_changelog_path) |> read_or_empty_string() |> clean_tagged_string(exclude)}

      #{:app |> Application.fetch_env!(:doc_schema_version_path) |> read_or_empty_string() |> clean_lines_containing(exclude)}

      """
    }
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions