efmt 0.1.0

Erlang code formatter
Documentation

efmt

efmt hex.pm version Documentation Actions Status License

An Erlang code formatter.

Features

  • Opinionated: only maximum line length is configurable by users
  • Emacs Erlang Mode friendly indentation
  • Preserves non-whitespace tokens of the original text as-is
    • Ensures the code after formatting keeps the same semantic meaning
  • Provides a rebar3 plugin: rebar3_efmt
  • Thorough macro support (MACRO_AND_PREPROCESS.md)

An Formatting Example

Before

-module(example).
-export(
  [fac/1]
).

fac(1) -> 1; fac(N) -> N*fac(N-1).

After

-module(example).
-export([fac/1]).

fac(1) ->
    1;
fac(N) ->
    N * fac(N - 1).

Please refer to FORMAT_RULES.md about the formatting style.

Installation

Usage

Editor Integrations

TODO

Comparison with other formatters

erlfmt

  • formatting style
  • error handling
  • macro handling
  • formatting speed
  • development phase

Limitations

There are some limitations that are not planned to be addressed in the future:

  • Only supports UTF-8 files
  • Doesn't process parse transforms
    • That is, if a parse transform has introduced custom syntaxes in your Erlang code, efmt could fail