Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.
/ steamroller Public archive

Steamroller: An opinionated Erlang code formatter.

License

Notifications You must be signed in to change notification settings

dtip/steamroller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚂 Steamroller

Build Badge

Steamroller is an opinionated Erlang code formatter. Uniformity is inevitable.

Austin Powers Steamroller Gif

Upset your colleagues by autoformatting their code.

This rebar3 plugin is still under development but should be considered reasonably stable. The Erlang abstract syntax tree is checked before and after formatting to make sure that the formatted file is equivalent to the original.

Steamroller should be used as part of your CI to enforce a consistent style across your codebase.

Use

Add steamroller to your rebar config:

{plugins, [steamroller]}.

Then ask it to steamroll your code directly in an existing application:

$ rebar3 steamroll
===> Fetching steamroller
===> Compiling steamroller
<Steamroller Output>

CI Check

To check that code is properly formatted as part of your CI:

$ rebar3 steamroll --check

The exit code will be non-zero if the code has not been formatted before being committed.

Configure

Steamroller comes with sensible default configuration. If you want, you can configure the line length, indent, and input files from your rebar config:

{
  steamroller,
  [
    {line_length, 100},
    {indent, 2},
    {inputs, ["rebar.config", "{src,test,include}/*.{[he]rl,app.src}"]}
  ]
}.

Editor Integration

Vim

You can use steamroller from vim with Neoformat.

Install Neoformat and then paste the below into your vimrc.

" Erlang autoformat
let g:neoformat_erlang_steamroller = {
  \ 'exe': 'rebar3',
  \ 'args': ['steamroll -f'],
  \ 'stdin': 0,
  \ 'replace': 1,
  \ }
let g:neoformat_enabled_erlang = ['steamroller']
autocmd BufWritePre rebar.config,*.[he]rl,*.app.src Neoformat steamroller

Visual Studio Code

You can use steamroller from Visual Studio Code with the Erlang Formatter extension created by szTheory.

Build

$ rebar3 compile

Test

$ rebar3 test

Dialyzer

Dialyzer is Erlang's static analysis tool.

$ rebar3 dialyzer

About

Steamroller: An opinionated Erlang code formatter.

Resources

License

Stars

Watchers

Forks

Packages

No packages published