THRIFT-5635 Update erlang client for Erlang 23-25
Client: erl
Patch: Sergey Yelin
This closes #2677
Summary of changes:
- Add useful compiler options
- Format sources using erlfmt
- Switch to modern callbacks in thrift_* modules
- Add static analysis (dialyzer), disabled by default
- Add/fix types for API calls
NOTE: Enabling static analysis requires additional tweaks in multiplexer module.
diff --git a/lib/erl/rebar.config b/lib/erl/rebar.config
index b5258a2..c3149b4 100644
--- a/lib/erl/rebar.config
+++ b/lib/erl/rebar.config
@@ -1,8 +1,55 @@
-{erl_opts, [debug_info]}.
+%% Common project erlang options.
+{erl_opts, [
+
+ % mandatory
+ debug_info,
+ warn_export_all,
+ 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
+]}.
+
+%% XRef checks
+{xref_checks, [
+ deprecated_functions_calls,
+ deprecated_functions
+]}.
+
+%% Dialyzer static analyzing
+{dialyzer, [
+ {warnings, [
+ % mandatory
+ unmatched_returns,
+ error_handling,
+ unknown
+ % hardcore mode
+ % overspecs,
+ % underspecs
+ ]},
+ {plt_extra_apps, [ssl, inets, public_key]}
+]}.
+
+{plugins, [
+ {erlfmt, "1.1.0"}
+]}.
+
+{erlfmt, [
+ {print_width, 100},
+ {files, "{src,include,test}/*.{hrl,erl,app.src}"}
+]}.
{profiles, [
{test, [
- {deps, [meck]},
+ {deps, [{meck, "0.9.2"}]},
{eunit_tests, [
{dir, "test"},
{dir, "test/gen-erl"}