Skip to content

Commit a3436a9

Browse files
Modernize the example and lint it
1 parent 4acf05e commit a3436a9

File tree

4 files changed

+39
-43
lines changed

4 files changed

+39
-43
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ jobs:
4848
[[ $R == "404" ]] || exit 1
4949
_build/default/rel/example/bin/example stop
5050
- name: Format check
51-
run: rebar3 format --verify
51+
run: |
52+
cd example
53+
rebar3 format --verify
5254
- name: check our example
5355
run: |
5456
cd example

example/rebar.config

Lines changed: 33 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,36 @@
1-
%% -*- mode: erlang;erlang-indent-level: 2;indent-tabs-mode: nil -*-
2-
%% ex: ts=4 sw=4 ft=erlang et
1+
%% == Compiler and Profiles ==
32

4-
%% == Erlang Compiler ==
5-
6-
%% Erlang compiler options
73
{erl_opts,
8-
[warn_unused_vars,
9-
warn_export_all,
10-
warn_shadow_vars,
11-
warn_unused_import,
12-
warn_unused_function,
13-
warn_bif_clash,
14-
warn_unused_record,
15-
warn_deprecated_function,
16-
warn_obsolete_guard,
17-
strict_validation,
18-
warn_export_vars,
19-
warn_exported_vars,
20-
warn_untyped_record,
21-
debug_info]}.
22-
23-
%% == Dependencies ==
24-
25-
{deps,
26-
[{mixer, "1.2.0", {pkg, inaka_mixer}},
27-
trails]}. % checked out
28-
29-
{project_plugins, [rebar3_lint, rebar3_hank, rebar3_format]}.
4+
[warn_unused_import, warn_export_vars, warnings_as_errors, verbose, report, debug_info]}.
5+
6+
{minimum_otp_vsn, "23"}.
7+
8+
{alias, [{test, [compile, format, hank, lint, xref, dialyzer]}]}.
9+
10+
%% == Dependencies and plugins ==
11+
12+
{deps, [{mixer, "1.2.0", {pkg, inaka_mixer}}, trails]}. % checked out
13+
14+
{project_plugins,
15+
[{rebar3_hank, "~> 1.4.0"}, {rebar3_format, "~> 1.3.0"}, {rebar3_lint, "~> 3.0.1"}]}.
16+
17+
%% == Format ==
18+
19+
{format, [{files, ["*.config", "src/*"]}]}.
20+
21+
%% == Hank ==
22+
23+
{hank, [{ignore, ["_build/**", "_checkouts"]}]}.
24+
25+
%% == Dialyzer + XRef ==
26+
27+
{dialyzer,
28+
[{warnings, [no_return, underspecs, unmatched_returns, error_handling, unknown]}]}.
29+
30+
{xref_checks,
31+
[undefined_function_calls, deprecated_function_calls, deprecated_functions]}.
32+
33+
{xref_extra_paths, ["test/**"]}.
3034

3135
%% == Shell (for interactive example) ==
3236

@@ -38,17 +42,5 @@
3842
[{include_src, false},
3943
{extended_start_script, true},
4044
{release, {example, "0.1"}, [example, sasl]},
41-
{sys_config, "rel/sys.config"}]}.
42-
43-
%% == Alias ==
44-
45-
{alias, [{test, [dialyzer, lint, hank]}]}.
46-
47-
%% == hank ==
48-
49-
{hank, [
50-
{ignore, [
51-
"_build/**",
52-
"_checkouts/**"
53-
]}
54-
]}.
45+
{sys_config, "rel/sys.config"},
46+
{vm_args, "rel/vm.args"}]}.

example/rel/vm.args

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-name example@127.0.0.1
2+
-setcookie bogus

example/src/example.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ stop(_State) ->
2929
ok = cowboy:stop_listener(example_http).
3030

3131
% start_listeners() ->
32-
-spec start_phase(atom(), application:start_type(), []) -> ok | {error, term()}.
32+
-spec start_phase(atom(), application:start_type(), []) -> ok.
3333
start_phase(start_trails_http, _StartType, []) ->
3434
{ok, Port} = application:get_env(example, http_port),
3535
{ok, ListenerCount} = application:get_env(example, http_listener_count),

0 commit comments

Comments
 (0)