View Source rebar3_formatter behaviour (rebar3_format v1.3.0)

Automatic formatter for Erlang modules

Link to this section Summary

Callbacks

Format a file. Note that opts() are not the same as the global ones passed in on init/2. These opts include per-file options specified with the -format attribute.

Functions

The action that the formatter will perform.
Format a file. Apply formatting rules to a file containing erlang code.
Process an ignored file. If output dir is not the current one we need to copy the files that we are not formatting to it
Build a formatter.

Link to this section Types

-type opts() ::
    #{output_dir => none | current | file:filename_all(),
      encoding => none | epp:source_encoding(),
      action => verify | format,
      _ => _}.
-type result() :: changed | unchanged.
-opaque t()

Link to this section Callbacks

-callback format_file(file:filename_all(), state(), opts()) -> result().
-callback init(opts(), undefined | rebar_state:t()) -> state().
Format a file. Note that opts() are not the same as the global ones passed in on init/2. These opts include per-file options specified with the -format attribute.

Link to this section Functions

-spec action(t()) -> verify | format.
The action that the formatter will perform.
Link to this function

format_file(File, Formatter)

View Source
-spec format_file(file:filename_all(), t()) -> result().
Format a file. Apply formatting rules to a file containing erlang code.
-spec ignore(file:filename_all(), t()) -> ok.
Process an ignored file. If output dir is not the current one we need to copy the files that we are not formatting to it
Link to this function

new(Module, Opts, RebarState)

View Source
-spec new(module(), opts(), undefined | rebar_state:t()) -> t().
Build a formatter.