Skip to content

With styling not idempotent #221

@emkguts

Description

@emkguts

Non-contrived issue this time 😉

When styling with, I have to run format twice for some code to style properly. The following test recreates the issue:

      assert_style(
        """
        with {:ok, result} <- foo(a),
             result <- Map.put(result, "my_key", "my_value"),
             {:ok, result} <- bar(a, result) do
          {:ok, result}
        end
        """,
        """
        with {:ok, result} <- foo(a) do
          result = Map.put(result, "my_key", "my_value")
          bar(a, result)
        end
        """
      )

and the error is:

     expected:
       with {:ok, result} <- foo(a) do
         result = Map.put(result, "my_key", "my_value")
         bar(a, result)
       end
     styled:
       with {:ok, result} <- foo(a),
            result = Map.put(result, "my_key", "my_value") do
         bar(a, result)
       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