Giter Site home page Giter Site logo

steamroller's Introduction

๐Ÿš‚ 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 early stage but could be used in production if you're brave. 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>

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

CI

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.

Build

$ rebar3 compile

Test

$ rebar3 test

Dialyzer

Dialyzer is Erlang's static analysis tool.

$ rebar3 dialyzer

Local Development

In order to use steamroller locally on itself you need to symlink the repo into the _checkouts directory:

cd $local_steamroller_repo
mkdir _checkouts
ln -s $PWD ./_checkouts/steamroller

Rebar3 will use the version of steamroller in the _checkouts directory with higher priority than the 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.

steamroller's People

Contributors

dtip avatar lpil avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.