Skip to content

Commit 1604aba

Browse files
authored
Fix ex_doc and rebar.config (#186)
1 parent 6c60392 commit 1604aba

7 files changed

+50
-37
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ priv/_*.json
1212
.eunit/
1313
db/
1414
_build/
15+
doc/
1516
Mnesia.nonode@nohost/
1617
*.DCD
1718
*.DCL

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ clean:
1919

2020
.PHONY: test
2121
test:
22+
rebar3 xref
2223
rebar3 eunit
2324
rebar3 fmt --check
2425
rebar3 dialyzer

rebar.config

+36-23
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
%%-*- mode: erlang -*-
2-
{cover_enabled, true}.
3-
41
{erl_opts, [
52
debug_info,
63
fail_on_warning,
@@ -10,7 +7,12 @@
107

118
{minimum_otp_vsn, "27"}.
129

13-
{project_plugins, [erlfmt, rebar3_depup]}.
10+
{project_plugins, [
11+
{rebar3_depup, "0.4.0"},
12+
{rebar3_hex, "~> 7.0"},
13+
{rebar3_ex_doc, "~> 0.2"},
14+
{erlfmt, "~> 1.6"}
15+
]}.
1416

1517
{deps, [
1618
{lager, "3.9.2"},
@@ -22,18 +24,19 @@
2224
{opentelemetry_api, "1.4.0"},
2325
{meck, "1.0.0"}
2426
]}.
25-
{profiles, [{test, [{deps, [proper]}]}]}.
2627

27-
{format, [
28-
{formatter, default_formatter},
29-
{files, ["src/**/*.?rl", "include/**/*.?rl"]},
30-
{options, #{
31-
paper => 160,
32-
ribbon => 150,
33-
inline_attributes => none,
34-
inline_qualified_function_composition => true
35-
}}
28+
{profiles, [
29+
{test, [
30+
{deps, [{proper, "1.4.0"}]},
31+
{erl_opts, [nowarn_export_all, nowarn_missing_spec, nowarn_missing_doc]},
32+
{covertool, [{coverdata_files, ["eunit.coverdata", "ct.coverdata"]}]},
33+
%% Increment min_coverage when deprecations are removed
34+
{cover_opts, [verbose, {min_coverage, 40}]},
35+
{cover_enabled, true},
36+
{cover_export_enabled, true}
37+
]}
3638
]}.
39+
3740
{depup, [{only, minor}]}.
3841

3942
{shell, [{apps, [erldns]}, {config, "erldns.config"}]}.
@@ -50,16 +53,26 @@
5053
{extended_start_script, true}
5154
]}.
5255

53-
{overrides, [
54-
{override, dns_erlang, [
55-
{plugins, [{provider_asn1, "0.2.3"}]},
56-
{provider_hooks, [
57-
{pre, [{compile, {asn, compile}}]},
58-
{post, [{clean, {asn, clean}}]}
59-
]}
60-
]}
61-
]}.
6256
{dialyzer, [{warnings, [no_unknown]}]}.
6357
{erlfmt, [write, {print_width, 140}]}.
6458

59+
{xref_checks, [
60+
locals_not_used,
61+
undefined_functions,
62+
undefined_function_calls,
63+
{deprecated_function_calls, next_major_release},
64+
{deprecated_functions, next_major_release}
65+
]}.
66+
67+
{hex, [{doc, #{provider => ex_doc}}]}.
68+
69+
{ex_doc, [
70+
{source_url, <<"https://github.com/dnsimple/erldns">>},
71+
{main, <<"readme">>},
72+
{extras, [
73+
{'README.md', #{title => <<"Overview">>}},
74+
{'LICENSE.md', #{title => <<"License">>}}
75+
]}
76+
]}.
77+
6578
%% This is a rebar3-ism

src/erldns_storage.erl

+6-7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
%% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1414
%% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1515

16+
%% Public API
17+
%% @doc API for a module's function calls. Please note that all crashes should be handled at the
18+
%% lowest level of the API (ex. erldns_storage_json).
19+
%% @end
1620
-module(erldns_storage).
1721

1822
-behaviour(gen_server).
@@ -81,11 +85,6 @@ terminate(_Reason, _State) ->
8185
code_change(_OldVsn, State, _Extra) ->
8286
{ok, State}.
8387

84-
%% Public API
85-
%% @doc API for a module's function calls. Please note that all crashes should be handled at the
86-
%% lowest level of the API (ex. erldns_storage_json).
87-
%% @end
88-
8988
%% @doc Call to a module's create. Creates a new table.
9089
-spec create(atom()) -> ok | {error, Reason :: term()}.
9190
create(Table) ->
@@ -116,14 +115,14 @@ select_delete(Table, MatchSpec) ->
116115
Module:select_delete(Table, MatchSpec).
117116

118117
%% @doc Backup the table to the JSON file.
119-
%% @see https://github.com/SiftLogic/erl-dns/issues/3
118+
%% https://github.com/SiftLogic/erl-dns/issues/3
120119
-spec backup_table(atom()) -> ok | {error, Reason :: term()}.
121120
backup_table(Table) ->
122121
Module = mod(Table),
123122
Module:backup_table(Table).
124123

125124
%% @doc Backup the tables to the JSON file.
126-
%% @see https://github.com/SiftLogic/erl-dns/issues/3
125+
%% https://github.com/SiftLogic/erl-dns/issues/3
127126
-spec backup_tables() -> ok | {error, Reason :: term()}.
128127
backup_tables() ->
129128
Module = mod(),

src/erldns_storage_json.erl

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ select_delete(Table, MatchSpec) ->
7979
{ok, Count}.
8080

8181
%% @doc Backup a specific ets table.
82-
%% @see https://github.com/SiftLogic/erl-dns/issues/3
82+
%% https://github.com/SiftLogic/erl-dns/issues/3
8383
-spec backup_table(atom()) -> ok | {error, Reason :: term()}.
8484
backup_table(_Table) ->
8585
{error, not_implemented}.
8686

8787
%% @doc Should backup all ets tables.
88-
%% @see https://github.com/SiftLogic/erl-dns/issues/3
88+
%% https://github.com/SiftLogic/erl-dns/issues/3
8989
-spec backup_tables() -> ok | {error, Reason :: term()}.
9090
backup_tables() ->
9191
{error, not_implemented}.

src/erldns_storage_mnesia.erl

+2-3
Original file line numberDiff line numberDiff line change
@@ -237,15 +237,14 @@ select_delete(Table, [{{{ZoneName, Fqdn, Type}, _}, _, _}]) ->
237237
end,
238238
mnesia:activity(transaction, SelectDelete).
239239

240-
%%
241240
%% @doc Should backup the tables in the schema.
242-
%% @see https://github.com/SiftLogic/erl-dns/issues/3
241+
%% https://github.com/SiftLogic/erl-dns/issues/3
243242
-spec backup_table(atom()) -> ok | {error, Reason :: term()}.
244243
backup_table(_Table) ->
245244
Backup = fun() -> mnesia:backup(mnesia:schema()) end,
246245
mnesia:activity(transaction, Backup).
247246

248-
%% @see https://github.com/SiftLogic/erl-dns/issues/3
247+
%% https://github.com/SiftLogic/erl-dns/issues/3
249248
-spec backup_tables() -> ok | {error, Reason :: term()}.
250249
backup_tables() ->
251250
{error, not_implemented}.

src/gen_nb_server.erl

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161

6262
-export_type([state/0]).
6363

64-
%% @spec start_link(CallbackModule, IpAddr, Port, InitParams) -> Result
64+
%% start_link(CallbackModule, IpAddr, Port, InitParams) -> Result
6565
%% CallbackModule = atom()
6666
%% IpAddr = string()
6767
%% Port = integer()
@@ -159,7 +159,7 @@ code_change(_OldVsn, State, _Extra) ->
159159
%% Internal functions
160160

161161
%% @hidden
162-
%% @spec listen_on(CallbackModule, IpAddr, Port) -> Result
162+
%% listen_on(CallbackModule, IpAddr, Port) -> Result
163163
%% CallbackModule = atom()
164164
%% IpAddr = string()
165165
%% Port = integer()

0 commit comments

Comments
 (0)