Current section
37 Versions
Jump to
Current section
37 Versions
Compare versions
12
files changed
+1581
additions
-1606
deletions
| @@ -9,9 +9,9 @@ Steamroller is an opinionated Erlang code formatter. Uniformity is inevitable. | |
| 9 9 | |
| 10 10 | Upset your colleagues by autoformatting their code. |
| 11 11 | |
| 12 | - This rebar3 plugin is early stage but could be used in production if you're brave. The Erlang |
| 13 | - abstract syntax tree is checked before and after formatting to make sure that the formatted file |
| 14 | - is equivalent to the original. |
| 12 | + This rebar3 plugin is still under development but should be considered reasonably stable. The |
| 13 | + Erlang abstract syntax tree is checked before and after formatting to make sure that the formatted |
| 14 | + file is equivalent to the original. |
| 15 15 | |
| 16 16 | Steamroller should be used as part of your CI to enforce a consistent style across your codebase. |
| 17 17 | |
| @@ -28,6 +28,20 @@ Then ask it to steamroll your code directly in an existing application: | |
| 28 28 | ===> Compiling steamroller |
| 29 29 | <Steamroller Output> |
| 30 30 | |
| 31 | + ## Configure |
| 32 | + |
| 33 | + Steamroller comes with sensible default configuration. If you want, you can configure the line |
| 34 | + length, indent, and input files from your rebar config: |
| 35 | + |
| 36 | + { |
| 37 | + steamroller, |
| 38 | + [ |
| 39 | + {line_length, 100}, |
| 40 | + {indent, 2}, |
| 41 | + {inputs, ["rebar.config", "{src,test}/**/*.{[he]rl,app.src}"]} |
| 42 | + ] |
| 43 | + }. |
| 44 | + |
| 31 45 | ## Editor Integration |
| 32 46 | |
| 33 47 | ### Vim |
| @@ -17,4 +17,4 @@ | |
| 17 17 | [{<<"app">>,<<"providers">>}, |
| 18 18 | {<<"optional">>,false}, |
| 19 19 | {<<"requirement">>,<<"1.8.1">>}]}]}. |
| 20 | - {<<"version">>,<<"0.11.6">>}. |
| 20 | + {<<"version">>,<<"0.12.0">>}. |
| @@ -1,20 +1,20 @@ | |
| 1 1 | %% == Erlang Compiler == |
| 2 2 | |
| 3 3 | { |
| 4 | - erl_opts, |
| 5 | - [ |
| 6 | - debug_info, |
| 7 | - report, |
| 8 | - verbose, |
| 9 | - warnings_as_errors, |
| 10 | - {warn_format, 1}, |
| 11 | - warn_export_all, |
| 12 | - warn_export_vars, |
| 13 | - warn_obsolete_guard, |
| 14 | - warn_untyped_record, |
| 15 | - warn_unused_import, |
| 16 | - warn_shadow_vars |
| 17 | - ] |
| 4 | + erl_opts, |
| 5 | + [ |
| 6 | + debug_info, |
| 7 | + report, |
| 8 | + verbose, |
| 9 | + warnings_as_errors, |
| 10 | + {warn_format, 1}, |
| 11 | + warn_export_all, |
| 12 | + warn_export_vars, |
| 13 | + warn_obsolete_guard, |
| 14 | + warn_untyped_record, |
| 15 | + warn_unused_import, |
| 16 | + warn_shadow_vars |
| 17 | + ] |
| 18 18 | }. |
| 19 19 | |
| 20 20 | %% == Dependencies == |
| @@ -29,34 +29,38 @@ | |
| 29 29 | |
| 30 30 | % Example Config |
| 31 31 | % line_length: 100 is the default but it can be configured here. |
| 32 | + % indent: 2 is the default but it can be configured here. |
| 32 33 | % inputs: list of wildcards to find files to autoformat. |
| 33 | - {steamroller, [{line_length, 100}, {inputs, ["rebar.config", "{src,test}/**/*.{[he]rl,app.src}"]}]}. |
| 34 | + { |
| 35 | + steamroller, |
| 36 | + [{line_length, 100}, {indent, 2}, {inputs, ["rebar.config", "{src,test}/**/*.{[he]rl,app.src}"]}] |
| 37 | + }. |
| 34 38 | |
| 35 39 | %% == Dialyzer == |
| 36 40 | |
| 37 41 | { |
| 38 | - dialyzer, |
| 39 | - [ |
| 40 | - {warnings, [unknown]}, |
| 41 | - % |
| 42 | - % Dialyzer will get upset if it has to analyse the provider. |
| 43 | - % |
| 44 | - % Tried adding 'rebar3' as a dep and to plt_extra_apps which seems like it should have |
| 45 | - % fixed the problem, but instead we get a load of 'Could not get Core Erlang code for:' |
| 46 | - % errors for all of the rebar3 beam files. Presumably because deps are compiled using |
| 47 | - % the prod profile and the rebar3 prod profile has 'no_debug_info'. |
| 48 | - % |
| 49 | - % Using `{overrides, [{override, rebar3, [{erl_opts, [debug_info]}]}]}.` seems to do |
| 50 | - % nothing. |
| 51 | - % |
| 52 | - % If you exclude only steamroller_prv then diazyler gets upset about steamroller:init |
| 53 | - % using an unknown function (steamroller_prv:init) so we exclude both. |
| 54 | - % |
| 55 | - % There must be an easy way to sort this out... |
| 56 | - % |
| 57 | - {plt_extra_apps, [providers]}, |
| 58 | - {exclude_mods, [steamroller, steamroller_prv, steamroller_worker]} |
| 59 | - ] |
| 42 | + dialyzer, |
| 43 | + [ |
| 44 | + {warnings, [unknown]}, |
| 45 | + % |
| 46 | + % Dialyzer will get upset if it has to analyse the provider. |
| 47 | + % |
| 48 | + % Tried adding 'rebar3' as a dep and to plt_extra_apps which seems like it should have |
| 49 | + % fixed the problem, but instead we get a load of 'Could not get Core Erlang code for:' |
| 50 | + % errors for all of the rebar3 beam files. Presumably because deps are compiled using |
| 51 | + % the prod profile and the rebar3 prod profile has 'no_debug_info'. |
| 52 | + % |
| 53 | + % Using `{overrides, [{override, rebar3, [{erl_opts, [debug_info]}]}]}.` seems to do |
| 54 | + % nothing. |
| 55 | + % |
| 56 | + % If you exclude only steamroller_prv then diazyler gets upset about steamroller:init |
| 57 | + % using an unknown function (steamroller_prv:init) so we exclude both. |
| 58 | + % |
| 59 | + % There must be an easy way to sort this out... |
| 60 | + % |
| 61 | + {plt_extra_apps, [providers]}, |
| 62 | + {exclude_mods, [steamroller, steamroller_prv, steamroller_worker]} |
| 63 | + ] |
| 60 64 | }. |
| 61 65 | |
| 62 66 | %% == Aliases == |
| @@ -1,6 +1,6 @@ | |
| 1 1 | {application,steamroller, |
| 2 2 | [{description,"An opinionated Erlang code formatter."}, |
| 3 | - {vsn,"0.11.6"}, |
| 3 | + {vsn,"0.12.0"}, |
| 4 4 | {registered,[]}, |
| 5 5 | {applications,[kernel,stdlib]}, |
| 6 6 | {env,[]}, |
| @@ -50,8 +50,8 @@ | |
| 50 50 | |
| 51 51 | -spec init(rebar_state:t()) -> {ok, rebar_state:t()}. |
| 52 52 | init(State) -> |
| 53 | - {ok, State1} = steamroller_prv:init(State), |
| 54 | - {ok, State1}. |
| 53 | + {ok, State1} = steamroller_prv:init(State), |
| 54 | + {ok, State1}. |
| 55 55 | |
| 56 56 | %% @doc Format a file. |
Loading more files…