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 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?

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?

mariusbutuc

mariusbutuc

@OvermindDL1 after a quick glance, is it https://github.com/elixir-lang/elixir/issues/7379 that you’re referencing, or a different one?

OvermindDL1

OvermindDL1

No there was another one, that one was just about length in strings.

Where Next?

Popular in Questions Top

Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
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
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
mathew4509
I have a list say x = ["23gh", "56kh", "97mh"] I would like to pass each element to Val in each iteration. Say, in iteration 1 -------...
New
Exadra37
Sometimes I want to check if the input into a function is not a blank string. My first approach: defmodule Example do def do_stuff(s...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
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...
273 38985 115
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
William
I would like to know that is there any online source for learning Phoenix Framework for building E-Commerce Store? Any advantage on build...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New

We're in Beta

About us Mission Statement