I need a good formatter for my Erlang code. What are the alternatives? I want the formatter to hook into my rebar3 build system and also be added as a post-hook in git.
I need a good formatter for my Erlang code. What are the alternatives? I want the formatter to hook into my rebar3 build system and also be added as a post-hook in git.
There are a bunch of formatters coming up lately…
At NextRoll, we created rebar3 format. It's a configurable formatter that is still under heavy development, but already usable.
There is also steamroller, which is more opinionated.
And there is people working on other non-public-yet formatters.
Check out this thread in the Elixir forum and this PR in the OTP repo.
You could take a look at steamroller, also a rebar3 plugin. Steamroller is an opinionated autoformatter similar to the built-in Elixir formatter. Very different from erl_tidy and emacs erlang-mode.
One option is erl_tidy, which comes as a rebar plugin:
https://github.com/tsloughter/erl_tidy
By default it does not override existing files. Instead, module.erl become module.erl.bak, but AFAIR it can be configured.
If what you want is erlang-mode style of formatting, you may take a look at fenollp/erlang-formatter, it can be used as a rebar3 plugin, or can be used in Makefile.
Please refer to the README of that repo for more details.