2021-02-26 10:27:07 +00:00
|
|
|
%% Common project erlang options.
|
|
|
|
{erl_opts, [
|
|
|
|
|
|
|
|
% mandatory
|
|
|
|
debug_info,
|
|
|
|
warnings_as_errors,
|
|
|
|
warn_export_all,
|
|
|
|
warn_missing_spec,
|
|
|
|
warn_untyped_record,
|
|
|
|
warn_export_vars,
|
|
|
|
|
|
|
|
% by default
|
|
|
|
warn_unused_record,
|
|
|
|
warn_bif_clash,
|
|
|
|
warn_obsolete_guard,
|
|
|
|
warn_unused_vars,
|
|
|
|
warn_shadow_vars,
|
|
|
|
warn_unused_import,
|
|
|
|
warn_unused_function,
|
|
|
|
warn_deprecated_function
|
|
|
|
|
|
|
|
% at will
|
|
|
|
% bin_opt_info
|
|
|
|
% no_auto_import
|
|
|
|
% warn_missing_spec_all
|
|
|
|
]}.
|
|
|
|
|
|
|
|
%% Common project dependencies.
|
|
|
|
{deps, [
|
|
|
|
{gun,
|
|
|
|
{git, "https://github.com/ninenines/gun.git",
|
|
|
|
{branch, "master"}
|
|
|
|
}},
|
|
|
|
{genlib,
|
|
|
|
{git, "https://github.com/rbkmoney/genlib.git",
|
|
|
|
{branch, "master"}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]}.
|
|
|
|
|
|
|
|
%% Helpful plugins.
|
|
|
|
{plugins, [
|
|
|
|
{rebar3_lint, "0.2.0"},
|
|
|
|
{erlfmt, "0.7.0"},
|
|
|
|
{rebar3_bench, "0.2.1"}
|
|
|
|
]}.
|
|
|
|
|
|
|
|
%% Linter config.
|
|
|
|
{elvis, [
|
|
|
|
#{
|
|
|
|
dirs => ["src"],
|
|
|
|
filter => "*.erl",
|
|
|
|
ruleset => erl_files,
|
|
|
|
ignore => [gunner_gun_event_handler], %% god_modules
|
|
|
|
rules => [
|
|
|
|
{elvis_style, line_length, #{limit => 120, skip_comments => false}},
|
|
|
|
{elvis_style, no_tabs},
|
|
|
|
{elvis_style, no_trailing_whitespace}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
#{
|
|
|
|
dirs => ["test"],
|
|
|
|
filter => "*.erl",
|
|
|
|
ruleset => erl_files,
|
|
|
|
rules => [
|
|
|
|
{elvis_style, line_length, #{limit => 120, skip_comments => false}},
|
|
|
|
% We want to use `ct:pal/2` and friends in test code.
|
|
|
|
{elvis_style, no_debug_call, disable},
|
|
|
|
% Tests are usually more comprehensible when a bit more verbose.
|
2021-06-11 09:58:01 +00:00
|
|
|
{elvis_style, dont_repeat_yourself, #{min_complexity => 60}},
|
|
|
|
{elvis_style, nesting_level, #{ level => 6 }}
|
2021-02-26 10:27:07 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
#{
|
|
|
|
dirs => ["."],
|
|
|
|
filter => "Makefile",
|
|
|
|
ruleset => makefiles
|
|
|
|
},
|
|
|
|
#{
|
|
|
|
dirs => ["."],
|
|
|
|
filter => "rebar.config",
|
|
|
|
rules => [
|
|
|
|
{elvis_style, line_length, #{limit => 120, skip_comments => false}},
|
|
|
|
{elvis_style, no_tabs},
|
|
|
|
{elvis_style, no_trailing_whitespace}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
#{
|
|
|
|
dirs => ["src"],
|
|
|
|
filter => "*.app.src",
|
|
|
|
rules => [
|
|
|
|
{elvis_style, line_length, #{limit => 120, skip_comments => false}},
|
|
|
|
{elvis_style, no_tabs},
|
|
|
|
{elvis_style, no_trailing_whitespace}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]}.
|
|
|
|
|
|
|
|
{elvis_output_format, colors}.
|
|
|
|
|
|
|
|
%% XRef checks
|
|
|
|
{xref_checks, [
|
|
|
|
undefined_function_calls,
|
|
|
|
undefined_functions,
|
|
|
|
deprecated_functions_calls,
|
|
|
|
deprecated_functions
|
|
|
|
]}.
|
|
|
|
% at will
|
|
|
|
% {xref_warnings, true}.
|
|
|
|
|
|
|
|
%% Tests
|
|
|
|
{cover_enabled, true}.
|
|
|
|
|
|
|
|
%% Dialyzer static analyzing
|
|
|
|
{dialyzer, [
|
|
|
|
{warnings, [
|
|
|
|
% mandatory
|
|
|
|
unmatched_returns,
|
|
|
|
error_handling,
|
|
|
|
race_conditions,
|
|
|
|
unknown
|
|
|
|
]},
|
|
|
|
{plt_apps, all_deps}
|
|
|
|
]}.
|
|
|
|
|
|
|
|
{shell, [{apps, [gunner]}]}.
|
|
|
|
|
|
|
|
{profiles, [
|
|
|
|
{prod, []},
|
|
|
|
{test, [
|
|
|
|
{cover_enabled, true},
|
|
|
|
{deps, [
|
2021-06-11 09:58:01 +00:00
|
|
|
{cowboy, "2.8.0"},
|
|
|
|
{ponos,
|
|
|
|
{git, "https://github.com/klarna/ponos.git",
|
|
|
|
{tag, "1.5.0"}
|
|
|
|
}
|
|
|
|
}
|
2021-02-26 10:27:07 +00:00
|
|
|
]}
|
|
|
|
]}
|
|
|
|
]}.
|
|
|
|
|
|
|
|
{erlfmt, [
|
|
|
|
{print_width, 120},
|
|
|
|
{files, "{src,test}/*.{hrl,erl}"}
|
|
|
|
]}.
|