What code formatters are available for Erlang?

Viewed 854

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.

edit: For a great overview, see this table.

4 Answers

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.

Related