%% == Erlang Compiler ==

{
  erl_opts,
  [
    debug_info,
    report,
    verbose,
    warnings_as_errors,
    {warn_format, 1},
    warn_export_all,
    warn_export_vars,
    warn_obsolete_guard,
    warn_untyped_record,
    warn_unused_import,
    warn_shadow_vars,
    {d, 'TEST_MACRO', 100}
  ]
}.

%% == Dependencies ==

{deps, [{providers, "1.8.1"}]}.

%% == Plugins ==

{plugins, [steamroller, {rebar3_autotest, "0.1.1"}, rebar3_hex]}.

%% == Steamroller ==

% Example Config
% line_length: 100 is the default but it can be configured here.
% indent: 2 is the default but it can be configured here.
% inputs: list of wildcards to find files to autoformat.
{
  steamroller,
  [{line_length, 100}, {indent, 2}, {inputs, ["rebar.config", "{src,test}/**/*.{[he]rl,app.src}"]}]
}.

%% == Dialyzer ==

{
  dialyzer,
  [
    {warnings, [unknown]},
    %
    % Dialyzer will get upset if it has to analyse the provider.
    %
    % Tried adding 'rebar3' as a dep and to plt_extra_apps which seems like it should have
    % fixed the problem, but instead we get a load of 'Could not get Core Erlang code for:'
    % errors for all of the rebar3 beam files. Presumably because deps are compiled using
    % the prod profile and the rebar3 prod profile has 'no_debug_info'.
    %
    % Using `{overrides, [{override, rebar3, [{erl_opts, [debug_info]}]}]}.` seems to do
    % nothing.
    %
    % If you exclude only steamroller_prv then diazyler gets upset about steamroller:init
    % using an unknown function (steamroller_prv:init) so we exclude both.
    %
    % There must be an easy way to sort this out...
    %
    {plt_extra_apps, [providers]},
    {exclude_mods, [steamroller, steamroller_prv, steamroller_worker]}
  ]
}.

%% == Aliases ==

{alias, [{check, [eunit, {steamroll, "--check"}, dialyzer]}, {test, [eunit]}]}.

%% == Overrides ==

% This is a hack so that steamroller can use itself as a plugin.
% Create a symlink in $REPO/_checkouts to $REPO.
% By overriding the dep steamroller's plugins we prevent an infinite dep loop.
{overrides, [{override, steamroller, [{plugins, []}]}]}.
