erlex

Convert Erlang style structs and error messages to equivalent Elixir.

Latest version: 0.2.6 registry icon
Maintenance score
0
Safety score
0
Popularity score
71
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High Critical
0.2.6 0 0 0 0 0
0.2.5 0 0 0 0 0
0.2.4 0 0 0 0 0
0.2.3 0 0 0 0 0
0.2.2 0 0 0 0 0
0.2.1 0 0 0 0 0
0.2.0 0 0 0 0 0
0.1.6 0 0 0 0 0
0.1.5 0 0 0 0 0
0.1.4 0 0 0 0 0
0.1.3 0 0 0 0 0
0.1.2 0 0 0 0 0
0.1.1 0 0 0 0 0
0.1.0 0 0 0 0 0

Stability
Latest release:

0.2.6 - This version may not be safe as it has not been updated for a long time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

Apache-2.0   -   Apache License 2.0

Not a wildcard

Not proprietary

OSI Compliant



Hex version badge Hex docs badge Total download badge License badge Build status badge Code coverage badge Last Updated badge

Erlex

Convert Erlang style structs and error messages to equivalent Elixir.

Useful for pretty printing things like Dialyzer errors and Observer state. NOTE: Because this code calls the Elixir formatter, it requires Elixir 1.6+.

Documentation

Hex Docs.

Changelog

Check out the Changelog.

Installation

The package can be installed from Hex by adding erlex to your list of dependencies in mix.exs:

def deps do
  [
    {:erlex, "~> 0.2"},
  ]
end

Usage

Invoke Erlex.pretty_print/1 with the input string.

iex> str = ~S"('Elixir.Plug.Conn':t(),binary() | atom(),'Elixir.Keyword':t() | map()) -> 'Elixir.Plug.Conn':t()"
iex> Erlex.pretty_print(str)
(Plug.Conn.t(), binary() | atom(), Keyword.t() | map()) :: Plug.Conn.t()

While the lion's share of the work is done via invoking Erlex.pretty_print/1, other higher order functions exist for further formatting certain messages by running through the Elixir formatter. Because we know the previous example is a type, we can invoke the Erlex.pretty_print_contract/1 function, which would format that appropriately for very long lines.

iex> str = ~S"('Elixir.Plug.Conn':t(),binary() | atom(),'Elixir.Keyword':t() | map(), map() | atom(), non_neg_integer(), binary(), binary(), binary(), binary(), binary()) -> 'Elixir.Plug.Conn':t()"
iex> Erlex.pretty_print_contract(str)
(
  Plug.Conn.t(),
  binary() | atom(),
  Keyword.t() | map(),
  map() | atom(),
  non_neg_integer(),
  binary(),
  binary(),
  binary(),
  binary(),
  binary()
) :: Plug.Conn.t()

Contributing

We welcome contributions of all kinds! To get started, click here.

Code of Conduct

Be sure to read and follow the code of conduct.