Skip to content
/ fermat Public

An opinionated source code formatter for Erlang

Notifications You must be signed in to change notification settings

youxkei/fermat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

2ec7d1f · Mar 6, 2021
Mar 3, 2021
Mar 6, 2021
Feb 28, 2021
Feb 28, 2021
Mar 3, 2021
Aug 8, 2020
Mar 5, 2021
Mar 5, 2021
Mar 3, 2021
Mar 5, 2021
Jan 21, 2021
Feb 21, 2021

Repository files navigation

Fermat

Fermat (/fɛrˈma/, フェルマー) is an opinionated code formatter for Erlang.

Fermat can also remove trailing separators.

Table of Contents

Installation

You can download the binary from the release page.

https://github.com/youxkei/fermat/releases/latest

Usage

Format code with removing trailing separators

$ cat <<EOF > /tmp/foo.erl
-module(foo).
-export([f/1,]).

f() when true,; ->
    [1234567890 || X <- [1234567890,], Y <- [1234567890,], foo:is_valid(X,),],;.
EOF

$ fermat -l 30 /tmp/foo.erl
-module(foo).
-export([f/1]).

f() when true ->
    [1234567890
     || X <- [1234567890],
        Y <- [1234567890],
        foo:is_valid(X)].

Don't format but remove trailing separators

$ cat <<EOF > /tmp/foo.erl
-module(foo).
-export([f/1,]).

f() when true,; ->
    [1234567890 || X <- [1234567890,], Y <- [1234567890,], foo:is_valid(X,),],;.
EOF

$ fermat -n /tmp/foo.erl
-module(foo).
-export([f/1]).

f() when true ->
    [1234567890 || X <- [1234567890], Y <- [1234567890], foo:is_valid(X)].