We’re maintaining a Phoenix server written by some devs who are no longer with the project. We have some CI machinery that checks the source code format with
mix format --check-formatted '{lib,priv,test,config}/**/*.{ex,exs}'
To get the code to pass this, I’m running
mix format
on my dev machine and committing the result.
Unfortunately, while mix format
on my dev machine MacOS (Elixir1.18.4) is fine with a particular file, mix format --check-formatted
running under Ubuntu 24.04 (Elixir 1.16 and 1.17) complains:
The following files are not formatted:
/home/runner/work/reticulum/reticulum/lib/ret/storage_used.ex
|
30 30 |
31 31 | {:ok, [_FS, _kb, used, _Avail], _RestStr} =
32 -| :io_lib.fread('~s~d~d~d', line |> to_charlist)
32 +| :io_lib.fread(~c"~s~d~d~d", line |> to_charlist)
33 33 |
34 34 | {:ok, [{:storage_used, used}]}
|
If I change that line as mix format appears to want, mix format
on my dev machine is cool with it and it passes the automated tests.
However, I’m reluctant to change code that has been working fine for years without understanding what’s going on.