Skip to content

Commit 5cd4b2d

Browse files
committed
make dilyzer silent about lager return matching
more spec fixes
1 parent 4fe4b09 commit 5cd4b2d

10 files changed

+90
-87
lines changed

src/boss_compiler.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
-type otp_version() :: 14|15|16|17.
1919
-spec(make_forms_by_version([syntaxTree()], otp_version()) ->syntaxTree()).
20-
-spec compile(binary() | [atom() | [any()] | char()]) -> any().
21-
-spec compile(binary() | [atom() | [any()] | char()],[any()]) -> any().
20+
-spec compile(binary() | [atom() | [any()] | char()]) -> {'error',atom() | {_,[any(),...]}}.
21+
-spec compile(binary() | [atom() | [any()] | char()],[any()]) -> {'error',atom() | {_,[any(),...]}}.
2222
-spec compile_forms(_,binary() | [atom() | [any()] | char()],atom() | [any()]) -> any().
2323

2424
-spec parse(binary() | [atom() | [any()] | char()],_,_) ->
@@ -44,7 +44,7 @@ compile(File) ->
4444
compile(File, []).
4545

4646
compile(File, Options) ->
47-
lager:notice("Compile file ~p with options ~p ", [File, Options]),
47+
_ = lager:notice("Compile file ~p with options ~p ", [File, Options]),
4848
IncludeDirs = ["include"] ++ proplists:get_value(include_dirs, Options, []) ++
4949
proplists:get_all_values(i, compiler_options(Options)),
5050
TokenTransform = proplists:get_value(token_transform, Options),

src/boss_db.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
start(Options) ->
7575
AdapterName = proplists:get_value(adapter, Options, mock),
7676
Adapter = list_to_atom(lists:concat(["boss_db_adapter_", AdapterName])),
77-
lager:info("Start Database Adapter ~p options ~p", [Adapter, Options]),
77+
_ = lager:info("Start Database Adapter ~p options ~p", [Adapter, Options]),
7878
Adapter:start(Options),
7979
lists:foldr(fun(ShardOptions, Acc) ->
8080
case proplists:get_value(db_shard_models, ShardOptions, []) of
@@ -136,7 +136,7 @@ create_migration_table_if_needed() ->
136136

137137
%% @doc Run database migration {Tag, Fun} in Direction
138138
migrate({Tag, Fun}, Direction) ->
139-
lager:info("Running migration: ~p ~p~n", [Tag, Direction]),
139+
_ = lager:info("Running migration: ~p ~p~n", [Tag, Direction]),
140140
Fun(Direction),
141141
db_call({migration_done, Tag, Direction}).
142142

src/boss_db_controller.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ find_by_key(Key, From, Prefix, State, _CachedValue = undefined) ->
283283
{Prefix, Key},
284284
State#state.cache_ttl);
285285
false ->
286-
lager:error("Find in Cache by key error ~p ~p ", [Key, Res]),
286+
_ = lager:error("Find in Cache by key error ~p ~p ", [Key, Res]),
287287
error
288288
end,
289289
{reply, Res, State};

src/boss_db_test_app.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ run_tests() ->
5959
boss_db:mock_transaction(fun run_tests_inner/0).
6060

6161
run_tests_inner() ->
62-
lager:info("~-60s", ["Root test"]),
62+
_ = lager:info("~-60s", ["Root test"]),
6363
ModelText = <<"Economists do it with models">>,
6464
do(
6565
fun() ->

src/boss_news_controller.erl

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,18 @@
4848
-export([activate_record/2]).
4949

5050
-export([future_time/1]).
51-
-spec make_wildcard_watchers(#state{watch_dict::dict:dict(),
52-
ttl_tree::gb_trees:tree(),
53-
set_watchers::dict:dict(),
54-
id_watchers::dict:dict(),
55-
set_attr_watchers::dict:dict(),
56-
id_attr_watchers::dict:dict(),
57-
watch_counter::integer()},
58-
_) -> any().
59-
51+
-spec make_wildcard_watchers(
52+
#state{
53+
watch_dict::dict:dict(_,_),
54+
ttl_tree::gb_trees:tree(_,_),
55+
set_watchers::dict:dict(_,_),
56+
id_watchers::dict:dict(_,_),
57+
set_attr_watchers::dict:dict(_,_),
58+
id_attr_watchers::dict:dict(_,_),
59+
watch_counter::integer()
60+
},
61+
binary() | maybe_improper_list(any(),binary() | [])
62+
) -> any().
6063

6164

6265
start_link() ->

src/boss_record_compiler.erl

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121

2222
-export([compile/1, compile/2, edoc_module/1, edoc_module/2, process_tokens/1, trick_out_forms/2]).
23-
-spec compile(binary() | [atom() | [any()] | char()]) -> any().
24-
-spec compile(binary() | [atom() | [any()] | char()],[any()]) -> any().
23+
-spec compile(binary() | [atom() | [any()] | char()]) -> {'error',atom() | {_,[any(),...]}}.
24+
-spec compile(binary() | [atom() | [any()] | char()],[any()]) -> {'error',atom() | {_,[any(),...]}}.
2525
-spec edoc_module(string()) -> {atom() | tuple(),_}.
2626
-spec edoc_module(string(),_) -> {module(),_}.
2727
-spec process_tokens(nonempty_maybe_improper_list()) -> {nonempty_maybe_improper_list(),[{_,_}]}.
@@ -38,18 +38,18 @@
3838
[pair(),...],
3939
[pair(),...],
4040
[ atom()]) -> error([syntaxTree()]).
41-
-spec has_duplicates([any()]) ->any().
42-
-spec trick_out_forms([any(),...],[any()]) -> [any(),...].
43-
-spec trick_out_forms([any(),...],[any()],[any()]) -> [any(),...].
41+
-spec has_duplicates([any()]) -> boolean().
42+
-spec trick_out_forms([any(),...],[{atom(),atom()},...]) -> [any(),...].
43+
-spec trick_out_forms([any(),...],[any()],[{atom(),atom()},...]) -> [any(),...].
4444
-spec trick_out_forms([any(),...],[any()],atom(),[any()],[any()]) -> [any(),...].
4545
-spec list_functions([atom()]) -> [fctn_n()].
4646
-spec list_functions([atom()],[fctn_n()]) -> [fctn_n()].
4747
-spec override_functions([syntaxTree()|fctn(),...],[fctn_n()]) -> [syntaxTree()].
4848
-spec override_functions([syntaxTree()|fctn()],[syntaxTree()],[fctn_n()]) -> [any()].
4949
-spec export_forms([{atom(), pos_integer()}]) -> syntaxTree().
5050
-spec export_forms([{atom(), pos_integer()}],[syntaxTree()]) -> syntaxTree().
51-
-spec database_columns_forms(atom() ,[atom()],[pair()]) -> syntaxTree().
52-
-spec database_table_forms(atom(),[pair()]) -> syntaxTree().
51+
-spec database_columns_forms(atom() ,[atom()],[pair()]) -> syntaxTree().
52+
-spec database_table_forms(atom(),[pair()]) -> syntaxTree().
5353
-spec attribute_types_forms(atom() ,[{atom(), atom()}]) -> syntaxTree().
5454
-spec validate_types_forms(atom()) -> syntaxTree().
5555
-spec validate_forms(atom()) -> syntaxTree().
@@ -62,12 +62,12 @@
6262
-spec set_attributes_forms(atom(),[atom()]) -> syntaxTree().
6363
-spec association_forms(atom(),[assoc()]) -> [any(),...].
6464

65-
-spec belongs_to_list_forms([{atom(),any()}]) -> syntaxTree().
65+
-spec belongs_to_list_forms([{atom(),atom()}]) -> [{'tree',atom(),{_,_,_,_},_} | {'wrapper',atom(),{_,_,_,_},_},...].
6666

67-
-spec belongs_to_list_make_list([pair()]) -> syntaxTree().
67+
-spec belongs_to_list_make_list([pair()]) -> syntaxTree().
6868
-spec attribute_names_forms(name(),[atom()]) -> syntaxTree().
6969
-spec has_one_forms(name(),atom(),[any()]) -> syntaxTree().
70-
-spec has_many_forms(atom(),atom(), limit(), [any()]) -> syntaxTree().
70+
-spec has_many_forms(atom(),atom(), limit(), [any()]) -> syntaxTree().
7171
-spec first_or_undefined_forms( syntaxTree()) -> syntaxTree().
7272
-spec has_many_application_forms(name(),{'tree',atom(),{'attr',_,[any()],'none' | {_,_,_}},_} | {'wrapper',atom(),{'attr',_,[any()],'none' | {_,_,_}},_},
7373
pos_integer() | all,
@@ -85,7 +85,7 @@
8585
-spec counter_reset_forms([name()]) -> syntaxTree().
8686
-spec counter_incr_forms([name()]) -> syntaxTree().
8787
-spec counter_name_forms(name()) -> syntaxTree().
88-
-spec parameter_to_colname(atom()) -> string().
88+
-spec parameter_to_colname(atom()) -> [byte()].
8989

9090

9191
%% @Spec compile( File::string() ) -> {ok, Module} | {error, Reason}
@@ -117,7 +117,7 @@ edoc_module(File, Options) ->
117117
Options).
118118

119119
process_tokens(Tokens) ->
120-
lager:info("Tokens ~p",[Tokens]),
120+
_ = lager:info("Tokens ~p",[Tokens]),
121121
process_tokens(Tokens, [], []).
122122

123123
process_tokens([{']',_},
@@ -149,7 +149,7 @@ process_tokens([{'-',_N } = T1,
149149
{')',_}|Rest] = _T,
150150
TokenAcc, []) ->
151151
% lager:notice("Tokens ~p", [_T]) ,
152-
lager:info("Var Type ~p",[VarType]),
152+
_ = lager:info("Var Type ~p",[VarType]),
153153
process_tokens(Rest, lists:reverse([T1, T2, T3, T4, T5, T6, T7], TokenAcc), [{'Id', VarType}]);
154154

155155
process_tokens([{',',_} = T1,
@@ -160,7 +160,7 @@ process_tokens([{',',_} = T1,
160160
{')',_} |Rest] = _T,
161161
TokenAcc, Acc) ->
162162
% lager:notice("Tokens ~p", [_T]),
163-
lager:info("Var Type ~p",[VarType]),
163+
_ = lager:info("Var Type ~p",[VarType]),
164164
process_tokens(Rest, lists:reverse([T1, T2], TokenAcc), [{VarName, VarType}|Acc]);
165165

166166
process_tokens([H|T], TokenAcc, Acc) ->
@@ -216,13 +216,13 @@ make_generated_forms(ModuleName, Parameters, _TokenInfo, _Attributes,
216216
make_generated_forms(ModuleName, Parameters, _TokenInfo, _Attributes,
217217
_Counters, _Dup = true) ->
218218
DupFields = Parameters -- sets:to_list(sets:from_list(Parameters)),
219-
lager:error("Unable to compile module ~p due to duplicate field(s) ~p",
219+
_ = lager:error("Unable to compile module ~p due to duplicate field(s) ~p",
220220
[ModuleName, DupFields]),
221221
{error, "Duplicate Fields"};
222222

223223
make_generated_forms(ModuleName, Parameters, TokenInfo, Attributes,
224224
Counters, _Dup = false) ->
225-
lager:notice("Module \"~p\" Parameters ~p Attributes~p", [ModuleName,Parameters, Attributes]),
225+
_ = lager:notice("Module \"~p\" Parameters ~p Attributes~p", [ModuleName,Parameters, Attributes]),
226226
GF = attribute_names_forms(ModuleName, Parameters) ++
227227
attribute_types_forms(ModuleName, TokenInfo) ++
228228
database_columns_forms(ModuleName, Parameters, Attributes) ++

src/cache_adapters/boss_cache_adapter_ets.erl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
-export([init/1, start/0, start/1, stop/1, terminate/1]).
66
-export([get/3, set/5, delete/3]).
77

8-
-spec start() -> 'ok'.
9-
-spec start(_) -> 'ok'.
10-
-spec stop(_) -> 'ok'.
11-
-spec init(_) -> {'ok','undefined'}.
12-
-spec terminate(_) -> 'ok'.
8+
-spec start() -> pid().
9+
-spec start(_) -> pid().
10+
-spec stop(atom() | pid() | {atom(),_} | {'via',_,_}) -> 'ok'.
11+
-spec init(_) -> {'ok', pid()}.
12+
-spec terminate(atom() | pid() | {atom(),_} | {'via',_,_}) -> 'ok'.
1313
-spec get(_,atom() | string() | number(),_) -> any().
1414
-spec set(_,atom() | string() | number(),_,_,non_neg_integer()) -> 'ok'.
1515
-spec delete(_,atom() | string() | number(),_) -> 'ok'.

src/db_adapters/boss_db_adapter_mongodb.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ execute({WriteMode, ReadMode, Connection, Database, User, Password}, Fun) ->
122122
true ->
123123
Fun();
124124
_ ->
125-
lager:error("Mongo DB Login Error check username and password ~p:~p", [User,Password]),
125+
_ = lager:error("Mongo DB Login Error check username and password ~p:~p", [User,Password]),
126126
{error,bad_login}
127127
end
128128
end).
@@ -285,7 +285,7 @@ resolve(_Res ={ok, _}) ->
285285
resolve(_Res = {failure, Reason}) ->
286286
{error, Reason};
287287
resolve(_Res = {connection_failure, Reason}) ->
288-
lager:error("connection failure ~p", [Reason]),
288+
_ = lager:error("connection failure ~p", [Reason]),
289289
{error, Reason}.
290290

291291

src/db_adapters/boss_db_adapter_mysql.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,11 +483,11 @@ pack_value(false) ->
483483
"FALSE".
484484

485485
fetch(Pid, Query) ->
486-
lager:info("Query ~s", [Query]),
486+
_ = lager:info("Query ~s", [Query]),
487487
Res = mysql_conn:fetch(Pid, [Query], self()),
488488
case Res of
489489
{error, MysqlRes} ->
490-
lager:error("SQL Error: ~p",[mysql:get_result_reason(MysqlRes)]);
490+
_ = lager:error("SQL Error: ~p",[mysql:get_result_reason(MysqlRes)]);
491491
_ -> ok
492492
end,
493493
Res.

0 commit comments

Comments
 (0)