elixir-lang / elixir

Elixir is a dynamic, functional language for building scalable and maintainable applications
https://elixir-lang.org/
Apache License 2.0
24.3k stars 3.35k forks source link

Formatter does not respect line length on function definitions #7604

Closed fertapric closed 6 years ago

fertapric commented 6 years ago

Environment

Elixir 1.6.4 (compiled with OTP 20)

* Operating system: Mac OS X

### Current behavior

The following code exceeds the default line length (line length 100, maximum line length 98), but the formatter does not split the function definition into multiple lines:

```elixir
defmodule LineLength do
  def a_really_really_really_long_function_name(first_argument, second_argument, third__argument) do
    :ok
  end
end

However, if the name of the last argument is changed to third____argument, then the formatter works as expected:

defmodule LineLength do
  def a_really_really_really_long_function_name(
        first_argument,
        second_argument,
        third____argument
      ) do
    :ok
  end
end

Expected behavior

I would expect the formatter to split the function definition into multiple lines if it exceeds the configured line length.

josevalim commented 6 years ago

Can you please add that as a comment to #7406? Thank you.