View Source rebar3_formatter behaviour (rebar3_format v1.3.0)
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().
Link to this section Functions
-spec action(t()) -> verify | format.
-spec format_file(file:filename_all(), t()) -> result().
-spec ignore(file:filename_all(), t()) -> ok.