Skip to content

Commit d603ba0

Browse files
Fixing dialyzer and removing square brackets around jiffy:encode used for locating lines that need changes.
1 parent d0a1572 commit d603ba0

23 files changed

+40
-74
lines changed

src/ejabberd_ctl.erl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,7 @@ handle_graphql_result({ok, Result}) ->
188188
end;
189189
handle_graphql_result({error, Reason}) ->
190190
{_Code, Error} = mongoose_graphql_errors:format_error(Reason),
191-
%CHANGED
192-
JSONResult = [jiffy:encode(#{errors => [Error]}, [pretty])],
191+
JSONResult = jiffy:encode(#{errors => [Error]}, [pretty]),
193192
?PRINT("~s\n", [JSONResult]),
194193
?STATUS_ERROR.
195194

src/event_pusher/mod_event_pusher_push_rdbms.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ decode_row({NodeID, PubSubBin, FormJSON}) ->
8181
NodeID,
8282
decode_form(FormJSON)}.
8383

84+
-spec encode_form(mod_event_pusher_push:form()) -> iodata().
8485
encode_form(Form) ->
85-
%CHANGED
86-
[jiffy:encode(Form)].
86+
jiffy:encode(Form).
8787

8888
decode_form(FormJSON) ->
8989
jiffy:decode(FormJSON, [return_maps]).

src/graphql/mongoose_graphql_handler.erl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,7 @@ make_error(Phase, Term) ->
274274

275275
reply_error(Msg, Req, State) ->
276276
{Code, Error} = mongoose_graphql_errors:format_error(Msg),
277-
%CHANGED
278-
Body = [jiffy:encode(#{errors => [Error]})],
277+
Body = jiffy:encode(#{errors => [Error]}),
279278
Req2 = cowboy_req:set_resp_body(Body, Req),
280279
Reply = cowboy_req:reply(Code, Req2),
281280
{stop, Reply, State}.

src/graphql/mongoose_graphql_sse_handler.erl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,5 @@ make_error(Phase, Term) ->
107107

108108
reply_error(Reason, Req, State) ->
109109
{Code, Error} = mongoose_graphql_errors:format_error(Reason),
110-
%CHANGED
111-
Body = [jiffy:encode(#{errors => [Error]})],
110+
Body = jiffy:encode(#{errors => [Error]}),
112111
{shutdown, Code, #{}, Body, Req, State}.

src/mod_caps_rdbms.erl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ read(HostType, {Node, SubNode}) ->
3131
-spec write(mongooseim:host_type(), mod_caps:node_pair(),
3232
mod_caps:maybe_pending_features()) -> ok.
3333
write(HostType, {Node, SubNode}, Features) ->
34-
%CHANGED
35-
Encoded = [jiffy:encode(Features)],
34+
Encoded = jiffy:encode(Features),
3635
InsertParams = [Node, SubNode, Encoded],
3736
UpdateParams = [Encoded],
3837
UniqueKeyValues = [Node, SubNode],

src/mod_push_service_mongoosepush.erl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ push_notifications(AccIn,
100100
ReqHeaders = [{<<"content-type">>, <<"application/json">>}],
101101
{ok, JSON} =
102102
make_notification(Notification, Options),
103-
%CHANGED
104-
Payload = [jiffy:encode(JSON)],
103+
Payload = jiffy:encode(JSON),
105104
call(Host, ?MODULE, http_notification, [Host, post, Path, ReqHeaders, Payload])
106105
end,
107106
{ok, send_push_notifications(Notifications, Fun, ok)}.

src/mongoose_admin_api/mongoose_admin_api.erl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,7 @@ resource_created(Req, State, Path, Body) ->
139139
%% @doc Send response when it can't be returned in a tuple from the handler (e.g. for DELETE)
140140
-spec respond(req(), state(), jiffy:json_value()) -> {stop, req(), state()}.
141141
respond(Req, State, Response) ->
142-
%CHANGED
143-
Req2 = cowboy_req:set_resp_body([jiffy:encode(Response)], Req),
142+
Req2 = cowboy_req:set_resp_body(jiffy:encode(Response), Req),
144143
Req3 = cowboy_req:reply(200, Req2),
145144
{stop, Req3, State}.
146145

@@ -151,8 +150,7 @@ error_response(ErrorType, Message, Req, State) ->
151150
error_type => ErrorType,
152151
message => BinMessage,
153152
req => Req}),
154-
%CHANGED
155-
Req1 = cowboy_req:reply(error_code(ErrorType), #{}, [jiffy:encode(BinMessage)], Req),
153+
Req1 = cowboy_req:reply(error_code(ErrorType), #{}, jiffy:encode(BinMessage), Req),
156154
{stop, Req1, State}.
157155

158156
-spec error_code(error_type()) -> non_neg_integer().

src/mongoose_admin_api/mongoose_admin_api_contacts.erl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ handle_get(Req, State) ->
7777
UserJid = get_user_jid(Bindings),
7878
case mod_roster_api:list_contacts(UserJid) of
7979
{ok, Rosters} ->
80-
%CHANGED
81-
{[jiffy:encode(lists:map(fun roster_info/1, Rosters))], Req, State};
80+
{jiffy:encode(lists:map(fun roster_info/1, Rosters)), Req, State};
8281
{unknown_domain, Reason} ->
8382
throw_error(not_found, Reason)
8483
end.

src/mongoose_admin_api/mongoose_admin_api_domain.erl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ handle_get(Req, State) ->
9292
Domain = get_domain(Bindings),
9393
case mongoose_domain_api:get_domain_details(Domain) of
9494
{ok, Props} ->
95-
%CHANGED
96-
{[jiffy:encode(maps:with([host_type, status], Props))], Req, State};
95+
{jiffy:encode(maps:with([host_type, status], Props)), Req, State};
9796
{not_found, Msg} ->
9897
throw_error(not_found, Msg);
9998
{_, Msg} ->

src/mongoose_admin_api/mongoose_admin_api_messages.erl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ handle_get(Req, State) ->
7272
case mongoose_stanza_api:lookup_recent_messages(OwnerJid, WithJid, Before, Limit, true) of
7373
{ok, {Rows, _Limit}} ->
7474
Messages = lists:map(fun row_to_map/1, Rows),
75-
%CHANGED
76-
{[jiffy:encode(Messages)], Req, State};
75+
{jiffy:encode(Messages), Req, State};
7776
{unknown_user, Msg} ->
7877
throw_error(bad_request, Msg)
7978
end.

0 commit comments

Comments
 (0)