Fermat (/fɛrˈma/, フェルマー) is an opinionated code formatter for Erlang.
Fermat can also remove trailing separators.
You can download the binary from the release page.
https://github.com/youxkei/fermat/releases/latest
$ cat <<EOF > /tmp/foo.erl
-module(foo).
-export([f/1,]).
f() when true,; ->
[1234567890 || X <- [1234567890,], Y <- [1234567890,], foo:is_valid(X,),],;.
EOF
$ fermat -l 30 /tmp/foo.erl
-module(foo).
-export([f/1]).
f() when true ->
[1234567890
|| X <- [1234567890],
Y <- [1234567890],
foo:is_valid(X)].
$ cat <<EOF > /tmp/foo.erl
-module(foo).
-export([f/1,]).
f() when true,; ->
[1234567890 || X <- [1234567890,], Y <- [1234567890,], foo:is_valid(X,),],;.
EOF
$ fermat -n /tmp/foo.erl
-module(foo).
-export([f/1]).
f() when true ->
[1234567890 || X <- [1234567890], Y <- [1234567890], foo:is_valid(X)].