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
It is not intended behaviour. please open up an issue and we will investigate!
Also Liked
mariusbutuc
Thank you for looking into this. Migrated over.
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
This actually sounds like the line-length bug that is fixed in elixir master’s formatter I would wager on initial guess?
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









