mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-20 17:27:00 +01:00
Fix Elvis report: Don't use ignored variables
https://github.com/inaka/elvis_core/blob/main/doc_rules/elvis_style/used_ignored_variable.md
This commit is contained in:
parent
90ce65e4dc
commit
74b80bfe08
@ -308,9 +308,9 @@ init([#body{attrs = Attrs}, IP, SID]) ->
|
|||||||
ignore
|
ignore
|
||||||
end.
|
end.
|
||||||
|
|
||||||
wait_for_session(_Event, State) ->
|
wait_for_session(Event, State) ->
|
||||||
?ERROR_MSG("Unexpected event in 'wait_for_session': ~p",
|
?ERROR_MSG("Unexpected event in 'wait_for_session': ~p",
|
||||||
[_Event]),
|
[Event]),
|
||||||
{next_state, wait_for_session, State}.
|
{next_state, wait_for_session, State}.
|
||||||
|
|
||||||
wait_for_session(#body{attrs = Attrs} = Req, From,
|
wait_for_session(#body{attrs = Attrs} = Req, From,
|
||||||
@ -367,16 +367,16 @@ wait_for_session(#body{attrs = Attrs} = Req, From,
|
|||||||
reply_next_state(State4, Resp#body{els = RespEls}, RID,
|
reply_next_state(State4, Resp#body{els = RespEls}, RID,
|
||||||
From)
|
From)
|
||||||
end;
|
end;
|
||||||
wait_for_session(_Event, _From, State) ->
|
wait_for_session(Event, _From, State) ->
|
||||||
?ERROR_MSG("Unexpected sync event in 'wait_for_session': ~p",
|
?ERROR_MSG("Unexpected sync event in 'wait_for_session': ~p",
|
||||||
[_Event]),
|
[Event]),
|
||||||
{reply, {error, badarg}, wait_for_session, State}.
|
{reply, {error, badarg}, wait_for_session, State}.
|
||||||
|
|
||||||
active({#body{} = Body, From}, State) ->
|
active({#body{} = Body, From}, State) ->
|
||||||
active1(Body, From, State);
|
active1(Body, From, State);
|
||||||
active(_Event, State) ->
|
active(Event, State) ->
|
||||||
?ERROR_MSG("Unexpected event in 'active': ~p",
|
?ERROR_MSG("Unexpected event in 'active': ~p",
|
||||||
[_Event]),
|
[Event]),
|
||||||
{next_state, active, State}.
|
{next_state, active, State}.
|
||||||
|
|
||||||
active(#body{attrs = Attrs, size = Size} = Req, From,
|
active(#body{attrs = Attrs, size = Size} = Req, From,
|
||||||
@ -408,9 +408,9 @@ active(#body{attrs = Attrs, size = Size} = Req, From,
|
|||||||
end;
|
end;
|
||||||
true -> active1(Req, From, State1)
|
true -> active1(Req, From, State1)
|
||||||
end;
|
end;
|
||||||
active(_Event, _From, State) ->
|
active(Event, _From, State) ->
|
||||||
?ERROR_MSG("Unexpected sync event in 'active': ~p",
|
?ERROR_MSG("Unexpected sync event in 'active': ~p",
|
||||||
[_Event]),
|
[Event]),
|
||||||
{reply, {error, badarg}, active, State}.
|
{reply, {error, badarg}, active, State}.
|
||||||
|
|
||||||
active1(#body{attrs = Attrs} = Req, From, State) ->
|
active1(#body{attrs = Attrs} = Req, From, State) ->
|
||||||
@ -517,9 +517,9 @@ handle_event({activate, C2SPid}, StateName,
|
|||||||
handle_event({change_shaper, Shaper}, StateName,
|
handle_event({change_shaper, Shaper}, StateName,
|
||||||
State) ->
|
State) ->
|
||||||
{next_state, StateName, State#state{shaper_state = Shaper}};
|
{next_state, StateName, State#state{shaper_state = Shaper}};
|
||||||
handle_event(_Event, StateName, State) ->
|
handle_event(Event, StateName, State) ->
|
||||||
?ERROR_MSG("Unexpected event in '~ts': ~p",
|
?ERROR_MSG("Unexpected event in '~ts': ~p",
|
||||||
[StateName, _Event]),
|
[StateName, Event]),
|
||||||
{next_state, StateName, State}.
|
{next_state, StateName, State}.
|
||||||
|
|
||||||
handle_sync_event({send_xml,
|
handle_sync_event({send_xml,
|
||||||
@ -557,9 +557,9 @@ handle_sync_event(deactivate_socket, _From, StateName,
|
|||||||
StateData) ->
|
StateData) ->
|
||||||
{reply, ok, StateName,
|
{reply, ok, StateName,
|
||||||
StateData#state{c2s_pid = undefined}};
|
StateData#state{c2s_pid = undefined}};
|
||||||
handle_sync_event(_Event, _From, StateName, State) ->
|
handle_sync_event(Event, _From, StateName, State) ->
|
||||||
?ERROR_MSG("Unexpected sync event in '~ts': ~p",
|
?ERROR_MSG("Unexpected sync event in '~ts': ~p",
|
||||||
[StateName, _Event]),
|
[StateName, Event]),
|
||||||
{reply, {error, badarg}, StateName, State}.
|
{reply, {error, badarg}, StateName, State}.
|
||||||
|
|
||||||
handle_info({timeout, TRef, wait_timeout}, StateName,
|
handle_info({timeout, TRef, wait_timeout}, StateName,
|
||||||
@ -583,9 +583,9 @@ handle_info({timeout, TRef, shaper_timeout}, StateName,
|
|||||||
{stop, normal, State};
|
{stop, normal, State};
|
||||||
_ -> {next_state, StateName, State}
|
_ -> {next_state, StateName, State}
|
||||||
end;
|
end;
|
||||||
handle_info(_Info, StateName, State) ->
|
handle_info(Info, StateName, State) ->
|
||||||
?ERROR_MSG("Unexpected info:~n** Msg: ~p~n** StateName: ~p",
|
?ERROR_MSG("Unexpected info:~n** Msg: ~p~n** StateName: ~p",
|
||||||
[_Info, StateName]),
|
[Info, StateName]),
|
||||||
{next_state, StateName, State}.
|
{next_state, StateName, State}.
|
||||||
|
|
||||||
terminate(_Reason, _StateName, State) ->
|
terminate(_Reason, _StateName, State) ->
|
||||||
|
@ -183,8 +183,8 @@ keep_alive(Host, Proc) ->
|
|||||||
Timeout) of
|
Timeout) of
|
||||||
{selected,_,[[<<"1">>]]} ->
|
{selected,_,[[<<"1">>]]} ->
|
||||||
ok;
|
ok;
|
||||||
_Err ->
|
Err ->
|
||||||
?ERROR_MSG("Keep alive query failed, closing connection: ~p", [_Err]),
|
?ERROR_MSG("Keep alive query failed, closing connection: ~p", [Err]),
|
||||||
sync_send_event(Proc, force_timeout, Timeout)
|
sync_send_event(Proc, force_timeout, Timeout)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -256,9 +256,9 @@ ws_loop(Codec, Socket, WsHandleLoopPid, SockMod, Shaper) ->
|
|||||||
"with pid ~p",
|
"with pid ~p",
|
||||||
[self()]),
|
[self()]),
|
||||||
websocket_close(Codec, Socket, WsHandleLoopPid, SockMod, 1001); % going away
|
websocket_close(Codec, Socket, WsHandleLoopPid, SockMod, 1001); % going away
|
||||||
_Ignored ->
|
Ignored ->
|
||||||
?WARNING_MSG("Received unexpected message, ignoring: ~p",
|
?WARNING_MSG("Received unexpected message, ignoring: ~p",
|
||||||
[_Ignored]),
|
[Ignored]),
|
||||||
ws_loop(Codec, Socket, WsHandleLoopPid,
|
ws_loop(Codec, Socket, WsHandleLoopPid,
|
||||||
SockMod, Shaper)
|
SockMod, Shaper)
|
||||||
end.
|
end.
|
||||||
|
@ -74,8 +74,8 @@ process([], #request{method = 'GET', data = <<>>}) ->
|
|||||||
{200, ?HEADER(?CT_XML), get_human_html_xmlel()};
|
{200, ?HEADER(?CT_XML), get_human_html_xmlel()};
|
||||||
process([], #request{method = 'OPTIONS', data = <<>>}) ->
|
process([], #request{method = 'OPTIONS', data = <<>>}) ->
|
||||||
{200, ?OPTIONS_HEADER, []};
|
{200, ?OPTIONS_HEADER, []};
|
||||||
process(_Path, _Request) ->
|
process(_Path, Request) ->
|
||||||
?DEBUG("Bad Request: ~p", [_Request]),
|
?DEBUG("Bad Request: ~p", [Request]),
|
||||||
{400, ?HEADER(?CT_XML),
|
{400, ?HEADER(?CT_XML),
|
||||||
#xmlel{name = <<"h1">>, attrs = [],
|
#xmlel{name = <<"h1">>, attrs = [],
|
||||||
children = [{xmlcdata, <<"400 Bad Request">>}]}}.
|
children = [{xmlcdata, <<"400 Bad Request">>}]}}.
|
||||||
|
@ -139,8 +139,8 @@ handle_call(Request, From, State) ->
|
|||||||
?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
|
?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
|
||||||
{noreply, State}.
|
{noreply, State}.
|
||||||
|
|
||||||
handle_cast(_Msg, State) ->
|
handle_cast(Msg, State) ->
|
||||||
?WARNING_MSG("Unexpected cast = ~p", [_Msg]),
|
?WARNING_MSG("Unexpected cast = ~p", [Msg]),
|
||||||
{noreply, State}.
|
{noreply, State}.
|
||||||
|
|
||||||
handle_info(clean, State) ->
|
handle_info(clean, State) ->
|
||||||
@ -151,8 +151,8 @@ handle_info(clean, State) ->
|
|||||||
ets:fun2ms(fun({_, _, UnbanTS, _}) -> UnbanTS =< Now end)),
|
ets:fun2ms(fun({_, _, UnbanTS, _}) -> UnbanTS =< Now end)),
|
||||||
erlang:send_after(?CLEAN_INTERVAL, self(), clean),
|
erlang:send_after(?CLEAN_INTERVAL, self(), clean),
|
||||||
{noreply, State};
|
{noreply, State};
|
||||||
handle_info(_Info, State) ->
|
handle_info(Info, State) ->
|
||||||
?WARNING_MSG("Unexpected info = ~p", [_Info]),
|
?WARNING_MSG("Unexpected info = ~p", [Info]),
|
||||||
{noreply, State}.
|
{noreply, State}.
|
||||||
|
|
||||||
terminate(_Reason, #state{host = Host}) ->
|
terminate(_Reason, #state{host = Host}) ->
|
||||||
|
@ -386,8 +386,8 @@ process([<<"federation">>, <<"v2">>, <<"send_join">>, RoomID, EventID],
|
|||||||
{result, HTTPResult} ->
|
{result, HTTPResult} ->
|
||||||
HTTPResult
|
HTTPResult
|
||||||
end;
|
end;
|
||||||
process(_Path, _Request) ->
|
process(Path, Request) ->
|
||||||
?DEBUG("matrix 404: ~p~n~p~n", [_Path, _Request]),
|
?DEBUG("matrix 404: ~p~n~p~n", [Path, Request]),
|
||||||
ejabberd_web:error(not_found).
|
ejabberd_web:error(not_found).
|
||||||
|
|
||||||
preprocess_federation_request(Request) ->
|
preprocess_federation_request(Request) ->
|
||||||
|
@ -127,8 +127,8 @@ remove_old_messages(Days, LServer) ->
|
|||||||
of
|
of
|
||||||
{updated, N} ->
|
{updated, N} ->
|
||||||
?INFO_MSG("~p message(s) deleted from offline spool", [N]);
|
?INFO_MSG("~p message(s) deleted from offline spool", [N]);
|
||||||
_Error ->
|
Error ->
|
||||||
?ERROR_MSG("Cannot delete message in offline spool: ~p", [_Error])
|
?ERROR_MSG("Cannot delete message in offline spool: ~p", [Error])
|
||||||
end,
|
end,
|
||||||
{atomic, ok}.
|
{atomic, ok}.
|
||||||
|
|
||||||
|
@ -340,16 +340,16 @@ update_roster_sql({LUser, LServer, SJID, Name, SSubscription, SAsk, AskMessage},
|
|||||||
|
|
||||||
raw_to_record(LServer,
|
raw_to_record(LServer,
|
||||||
[User, LServer, SJID, Nick, SSubscription, SAsk, SAskMessage,
|
[User, LServer, SJID, Nick, SSubscription, SAsk, SAskMessage,
|
||||||
_SServer, _SSubscribe, _SType]) ->
|
SServer, SSubscribe, SType]) ->
|
||||||
raw_to_record(LServer,
|
raw_to_record(LServer,
|
||||||
{User, LServer, SJID, Nick, SSubscription, SAsk, SAskMessage,
|
{User, LServer, SJID, Nick, SSubscription, SAsk, SAskMessage,
|
||||||
_SServer, _SSubscribe, _SType});
|
SServer, SSubscribe, SType});
|
||||||
raw_to_record(LServer,
|
raw_to_record(LServer,
|
||||||
{User, SJID, Nick, SSubscription, SAsk, SAskMessage,
|
{User, SJID, Nick, SSubscription, SAsk, SAskMessage,
|
||||||
_SServer, _SSubscribe, _SType}) ->
|
SServer, SSubscribe, SType}) ->
|
||||||
raw_to_record(LServer,
|
raw_to_record(LServer,
|
||||||
{User, LServer, SJID, Nick, SSubscription, SAsk, SAskMessage,
|
{User, LServer, SJID, Nick, SSubscription, SAsk, SAskMessage,
|
||||||
_SServer, _SSubscribe, _SType});
|
SServer, SSubscribe, SType});
|
||||||
raw_to_record(LServer,
|
raw_to_record(LServer,
|
||||||
{User, LServer, SJID, Nick, SSubscription, SAsk, SAskMessage,
|
{User, LServer, SJID, Nick, SSubscription, SAsk, SAskMessage,
|
||||||
_SServer, _SSubscribe, _SType}) ->
|
_SServer, _SSubscribe, _SType}) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user