exfmt v0.1.0 Exfmt

Exfmt, an opinionated Elixir source code formatter. 🌸

aka The everyone’s favourite Elixir-to-Elixir compiler.

API

Functions in this module can be considered part of Exfmt’s public interface, and can be presumed stable. Functions exposed by other modules may change at any time without warning, especially before v1.0.0.

Link to this section Summary

Functions

Check that a string of source code conforms to the exfmt style. If formatting the source code would not result in the source code changing this function will return :ok

Format a string of Elixir source code

Format a string of Elixir source code, throwing an exception in the event of failure

Link to this section Functions

Link to this function check(source, max_width \\ 80)
check(String.t, integer) ::
  :ok |
  {:format_error, String.t} |
  Exfmt.SyntaxError.t

Check that a string of source code conforms to the exfmt style. If formatting the source code would not result in the source code changing this function will return :ok.

Link to this function format(source, max_width \\ 80)
format(String.t, integer) ::
  {:ok, String.t} |
  Exfmt.SyntaxError.t

Format a string of Elixir source code.

iex> format("[1,2,3]")
{:ok, "[1, 2, 3]\n"}
Link to this function format!(source, max_width \\ 80)
format!(String.t, integer) :: String.t

Format a string of Elixir source code, throwing an exception in the event of failure.

iex> format!("[1,2,3]")
"[1, 2, 3]\n"