Current section
Files
Jump to
Current section
Files
steamroller
README.md
README.md
🚂 Steamroller==============Steamroller is an opinionated Erlang code formatter. Uniformity is inevitable.Upset your colleagues by autoformatting their code.This rebar3 plugin is early stage but could be used in production if you're brave. The Erlangabstract syntax tree is checked before and after formatting to make sure that the formatted fileis equivalent to the original.Steamroller should be used as part of your CI to enforce a consistent style across your codebase.## UseAdd 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>By default, steamroller uses a j factor of 4. To change this: $ rebar3 steamroll -j 8## Editor Integration### VimYou can use steamroller from vim with [Neoformat](https://github.com/sbdchd/neoformat).Install Neoformat and then paste the below into your vimrc.```viml" Erlang autoformatlet 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```## CITo check that code is properly formatted as part of your CI: $ rebar3 steamroll --checkThe exit code will be non-zero if the code has not been formatted before being committed.## Build $ rebar3 compile## Test $ rebar3 test## DialyzerDialyzer is Erlang's static analysis tool. $ rebar3 dialyzer## Local DevelopmentIn order to use steamroller locally on itself you need to symlink the repo into the \_checkoutsdirectory: cd $local_steamroller_repo mkdir _checkouts ln -s $PWD ./_checkouts/steamrollerRebar3 will use the version of steamroller in the \_checkouts directory with higher priority thanthe version specified in the rebar.config. There's a line in the rebar.config (see `overrides`)which prevents infinite plugin loops when using steamroller locally like this.