mariusbutuc

mariusbutuc

[mix format] What is considered to be relevant when calculating line length?

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 GitHub - elixir-lang/elixir: Elixir is a dynamic, functional language for building scalable and maintainable applications · GitHub
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?

Marked As Solved

josevalim

josevalim

Creator of Elixir

It is not intended behaviour. please open up an issue and we will investigate!

Also Liked

mariusbutuc

mariusbutuc

Thank you for looking into this. Migrated over.

mariusbutuc

mariusbutuc

Gave Elixir 1.6.2 a shot this morning and the behaviour is the same.

Erlang/OTP 20 [erts-9.2.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false]

Elixir 1.6.2 (compiled with OTP 20)

If this is not intended behaviour, is it worth migrating this to a GitHub issue on the elixir repo?
(cc @josevalim)

OvermindDL1

OvermindDL1

This actually sounds like the line-length bug that is fixed in elixir master’s formatter I would wager on initial guess?

Where Next?

Popular in Questions Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
Kurisu
For example for a current url like http://localhost:4000/cosmetic/products?_utf8=✓&query=perfume&page=2, I would like to get: ...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

Other popular topics Top

TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 41989 114
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39467 209
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement