% -*- mode: erlang; -*- vim: set ft=erlang:

%% == Erlang Compiler == %%

{erl_opts, [
    debug_info,
    warn_export_vars,
    warn_missing_spec,
    warn_unused_import,
    % warnings_as_errors,
    %
    % EEP-48
    {platform_define, "^2[7-9]\\.", 'E48'},
    {platform_define, "^[3-9]", 'E48'}
]}.

%% == Dependencies and plugins ==

{deps, []}.

{project_plugins, [
    {erlfmt, "~> 1.7"},
    {rebar3_hank, "~> 1.4"},
    {rebar3_hex, "~> 7.0"},
    {rebar3_lint, "~> 4.1.0"}
]}.

%% == Formatter ==

{erlfmt, [write]}.

%% == Dialyzer ==

{dialyzer, [
    {warnings, [
        error_handling,
        % we use improper lists extensively
        no_improper_lists,
        underspecs,
        unknown,
        unmatched_returns
    ]},
    {plt_extra_apps, [
        common_test,
        doctest,
        eunit
    ]}
]}.

%% == Xref ==

{xref_checks, [
    deprecated_function_calls,
    exports_not_used,
    locals_not_used,
    undefined_function_calls
]}.

%% == Profiles ==

{profiles, [
    {shell, [
        {deps, [
            {recon, "~> 2.5"}
        ]}
    ]},

    {test, [
        {erl_opts, [
            debug_info,
            nowarn_export_all,
            nowarn_missing_spec,
            nowarnings_as_errors
        ]},
        {deps, [
            {doctest, "~> 0.13.1"}
        ]},
        {shell, [
            {apps, [xb5]},
            {config, "test/config/sys.config"}
        ]},
        {ct_opts, [{timing, true}]},
        % {cover_enabled, true},
        {cover_opts, [verbose]}
    ]}
]}.

% doctest: required to pretty print and correctly displays the failed Eunit tests.
{eunit_opts, [no_tty, {report, {doctest_eunit_report, []}}]}.

%% == Docs ==

{edoc_opts, [
    {includes, ["."]},
    % Necessary for ExDoc.
    {preprocess, true},
    {doclet, edoc_doclet_chunks},
    {layout, edoc_layout_chunks},
    {dir, "_build/docs/lib/xb5/doc"}
]}.

{hex, [
    {doc, #{
        provider => ex_doc
    }}
]}.
