erlalign (erlalign v0.1.6)
View SourceErlang code formatter that applies column alignment on top of erlfmt output
ErlAlign mirrors ExAlign's functionality for Erlang source code, enabling readable column-aligned formatting similar to Go's gofmt
Summary
Functions
Align case/if arrows: Pattern -> Body
Align consecutive variable assignments: Var = value
Format Erlang source contents with column alignment. Options are merged from three sources with the following precedence
Load and merge configuration options from local config merged with global config
Load and merge configuration options from CLI, local config, and global config with correct precedence
Load global configuration from ~/.config/erlalign/.formatter.config. Returns a list of options or empty list if file not found or invalid.
Load local configuration from .formatter.config in the current directory. Returns a list of options or empty list if file not found or invalid.
Main CLI entry point. Parses arguments and runs the formatter Calls erlang:halt/1 with appropriate exit code
Set default value for trim_eol_ws option if not already set Default is true (trim trailing whitespace)
Trim trailing whitespace from all lines if trim_eol_ws option is true
Functions
Align case/if arrows: Pattern -> Body
Align consecutive variable assignments: Var = value
Format Erlang source contents with column alignment. Options are merged from three sources with the following precedence:
- Opts argument (highest priority)
- Local config from .formatter.config in current directory
- Global config from ~/.config/erlalign/.formatter.config (lowest priority)
Supported options:
line_length(integer, default 98): Maximum line length for alignmenteol_at_eof(:add,:remove, ornil, defaultnil): Controls end-of-file newline handling:add: add trailing newline if not present:remove: remove all trailing newlinesnil: leave end-of-file newline unchanged
keep_separators(boolean, defaultfalse): Preserve separator linestrim_eol_ws(boolean, defaulttrue): Trim trailing whitespace from lines
-spec init(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
Load and merge configuration options from local config merged with global config
Load and merge configuration options from CLI, local config, and global config with correct precedence
Load global configuration from ~/.config/erlalign/.formatter.config. Returns a list of options or empty list if file not found or invalid.
Load local configuration from .formatter.config in the current directory. Returns a list of options or empty list if file not found or invalid.
Main CLI entry point. Parses arguments and runs the formatter Calls erlang:halt/1 with appropriate exit code
Set default value for trim_eol_ws option if not already set Default is true (trim trailing whitespace)
Trim trailing whitespace from all lines if trim_eol_ws option is true