{min_otp_version, "19.0"}.

{erl_first_files, ["src/partisan_gen.erl", "src/partisan_gen_server.erl", "src/partisan_gen_fsm.erl"]}.

{deps, [
        %% Core dependencies
        {uuid, {pkg, uuid_erl}},
        {acceptor_pool, "1.0.0"},
        {types, "~> 0.1"},
        {lager, "~> 3.5"}

        %% Applications under test
        %% {hbbft, {git, "git://github.com/helium/erlang-hbbft", {branch, "master"}}}
        %% {riak_ensemble, {git, "git://github.com/cmeiklejohn/riak_ensemble", {branch, "partisan"}}},
        %% {paxoid, {git, "git://github.com/cmeiklejohn/paxoid", {branch, "partisan"}}},
        %% {lashup, {git, "git://github.com/cmeiklejohn/lashup", {branch, "partisan"}}},
        %% {hbbft, {git, "git://github.com/helium/erlang-hbbft", {branch, "master"}}},
        %% {zraft_lib, {git, "git://github.com/cmeiklejohn/zraft_lib", {branch, "master"}}}
       ]}.

{dialyzer_base_plt_apps, [kernel, stdlib, erts, sasl, eunit, syntax_tools, compiler, crypto]}.
{xref_checks, [undefined_function_calls]}.
{erl_opts, [debug_info,
            warnings_as_errors,
            {parse_transform, lager_transform},
            {lager_truncation_size, 8192}]}.
{cover_enabled, true}.
{eunit_opts, [verbose, {report,{eunit_surefire,[{dir,"."}]}}]}.
{edoc_opts, [{preprocess, true}]}.

{project_plugins, [
    {rebar3_proper, "0.10.1"},
    {rebar3_run, {git, "git://github.com/tsloughter/rebar3_run.git", {branch, "master"}}}
]}.

{profiles, [
    {test, [
        {extra_src_dirs, ["protocols"]},

        {deps, [{eredis, {git, "git://github.com/wooga/eredis.git", {tag, "master"}}},
                {jsx, "2.8.0"},
                {proper, "1.2.0"},
                recon]},

         {relx, [{release, {partisan, "4.0.0"}, [eredis, partisan]},
                 {extended_start_script, true},

                 {dev_mode, true},
                 {include_erts, false},

                 {sys_config, "config/sys.config"},
                 {vm_args, "config/vm.args"},

                 {overlay, [{mkdir, "log/sasl"},
                            {mkdir, "data/"},
                            {copy, "bin/env", "bin"}]}]},
        {erl_opts, [nowarn_export_all, nowarn_deprecated_function]}
    ]},
    {lint,  [
        {plugins, [rebar3_lint]}
    ]},
    {docs, [
        {deps, [edown]}
    ]}
]}.

{elvis,
 [#{dirs => ["src"],
       filter => "*.erl",
       rules => [
                 %% {elvis_style, line_length,
                 %%  #{ignore => [],
                 %%    limit => 80,
                 %%    skip_comments => false}},
                 {elvis_style, no_tabs},
                 {elvis_style, no_trailing_whitespace},
                 {elvis_style, macro_names, #{ignore => []}},
                 %% {elvis_style, macro_module_names},
                 {elvis_style, operator_spaces, #{rules => [{right, ","},
                                                            {right, "++"},
                                                            {left, "++"}]}},
                 %% {elvis_style, nesting_level, #{level => 3}},
                 {elvis_style, god_modules,
                  #{limit => 25,
                    ignore => []}},
                 {elvis_style, no_if_expression},
                 %% {elvis_style, invalid_dynamic_call, #{ignore => []}},
                 {elvis_style, used_ignored_variable},
                 {elvis_style, no_behavior_info},
                 {
                   elvis_style,
                   module_naming_convention,
                   #{regex => "^[a-z]([a-z0-9]*_?)*(_SUITE)?$",
                     ignore => []}
                 },
                 {
                   elvis_style,
                   function_naming_convention,
                   #{regex => "^([a-z][a-z0-9]*_?)*$"}
                 },
                 {elvis_style, state_record_and_type},
                 {elvis_style, no_spec_with_records}
                 %% {elvis_style, dont_repeat_yourself, #{min_complexity => 10}}
                 %% {elvis_style, no_debug_call, #{ignore => []}}
                ]
      },
     #{dirs => ["."],
       filter => "Makefile",
       rules => [{elvis_project, no_deps_master_erlang_mk, #{ignore => []}},
                 {elvis_project, protocol_for_deps_erlang_mk, #{ignore => []}}]
      },
     #{dirs => ["."],
       filter => "rebar.config",
       rules => [{elvis_project, no_deps_master_rebar, #{ignore => []}},
                 {elvis_project, protocol_for_deps_rebar, #{ignore => []}}]
      }
    ]
}.
