It seems to me that credo
and mix format
currently calculate the
line length differently.
This experiment is running
-
credo --strict
(v0.8.10) -
mix format --check-formatted
(Elixir 1.6.1 on Erlang/OTP 20.2.3)
and here is the noticed behaviour and the change I did to reconcile:
xxxxxxxxxxx: %{
xxxxxxxxxxxxxxxx: %{
xxxx: get_in(xxxxxxxxxxx, [:xxxxxxx, :xxxxxxxxxxxxxxxx, :xxxx]),
+ # credo:disable-for-lines:2 Credo.Check.Readability.MaxLineLength
xxxxxxxxxxxxxx:
- get_in(xxxxxxxxxxx,
- [:xxxxxxx, :xxxxxxxxxxxxxxxx, :xxxxxxxxxxxxxx]),
+ get_in(xxxxxxxxxxx, [:xxxxxxx, :xxxxxxxxxxxxxxxx, :xxxxxxxxxxxxxx]),
xxxxxxxx:
get_in(xxxxxxxxxxx, [:xxxxxxx, :xxxxxxxxxxxxxxxx, :xxxxxxxx])
},
The old code wrapped around the 80 character limit. credo
is happy, but
mix format
wants everything on one line, as the closing parenthesis and
comma seem to not be counted in the line length.
Don’t know if this is worth opening an issue on https://github.com/elixir-lang/elixir
or if this is desired and expected behaviour.
PS: @AstonJ please help me triage this post if I didn’t figure out the best place for it?