25
1
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:
Badlop 2024-08-26 11:05:29 +02:00
parent 90ce65e4dc
commit 74b80bfe08
8 changed files with 32 additions and 32 deletions

View File

@ -308,9 +308,9 @@ init([#body{attrs = Attrs}, IP, SID]) ->
ignore
end.
wait_for_session(_Event, State) ->
wait_for_session(Event, State) ->
?ERROR_MSG("Unexpected event in 'wait_for_session': ~p",
[_Event]),
[Event]),
{next_state, wait_for_session, State}.
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,
From)
end;
wait_for_session(_Event, _From, State) ->
wait_for_session(Event, _From, State) ->
?ERROR_MSG("Unexpected sync event in 'wait_for_session': ~p",
[_Event]),
[Event]),
{reply, {error, badarg}, wait_for_session, State}.
active({#body{} = Body, From}, State) ->
active1(Body, From, State);
active(_Event, State) ->
active(Event, State) ->
?ERROR_MSG("Unexpected event in 'active': ~p",
[_Event]),
[Event]),
{next_state, active, State}.
active(#body{attrs = Attrs, size = Size} = Req, From,
@ -408,9 +408,9 @@ active(#body{attrs = Attrs, size = Size} = Req, From,
end;
true -> active1(Req, From, State1)
end;
active(_Event, _From, State) ->
active(Event, _From, State) ->
?ERROR_MSG("Unexpected sync event in 'active': ~p",
[_Event]),
[Event]),
{reply, {error, badarg}, active, State}.
active1(#body{attrs = Attrs} = Req, From, State) ->
@ -517,9 +517,9 @@ handle_event({activate, C2SPid}, StateName,
handle_event({change_shaper, Shaper}, StateName,
State) ->
{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",
[StateName, _Event]),
[StateName, Event]),
{next_state, StateName, State}.
handle_sync_event({send_xml,
@ -557,9 +557,9 @@ handle_sync_event(deactivate_socket, _From, StateName,
StateData) ->
{reply, ok, StateName,
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",
[StateName, _Event]),
[StateName, Event]),
{reply, {error, badarg}, StateName, State}.
handle_info({timeout, TRef, wait_timeout}, StateName,
@ -583,9 +583,9 @@ handle_info({timeout, TRef, shaper_timeout}, StateName,
{stop, normal, State};
_ -> {next_state, StateName, State}
end;
handle_info(_Info, StateName, State) ->
handle_info(Info, StateName, State) ->
?ERROR_MSG("Unexpected info:~n** Msg: ~p~n** StateName: ~p",
[_Info, StateName]),
[Info, StateName]),
{next_state, StateName, State}.
terminate(_Reason, _StateName, State) ->

View File

@ -183,8 +183,8 @@ keep_alive(Host, Proc) ->
Timeout) of
{selected,_,[[<<"1">>]]} ->
ok;
_Err ->
?ERROR_MSG("Keep alive query failed, closing connection: ~p", [_Err]),
Err ->
?ERROR_MSG("Keep alive query failed, closing connection: ~p", [Err]),
sync_send_event(Proc, force_timeout, Timeout)
end.

View File

@ -256,9 +256,9 @@ ws_loop(Codec, Socket, WsHandleLoopPid, SockMod, Shaper) ->
"with pid ~p",
[self()]),
websocket_close(Codec, Socket, WsHandleLoopPid, SockMod, 1001); % going away
_Ignored ->
Ignored ->
?WARNING_MSG("Received unexpected message, ignoring: ~p",
[_Ignored]),
[Ignored]),
ws_loop(Codec, Socket, WsHandleLoopPid,
SockMod, Shaper)
end.

View File

@ -74,8 +74,8 @@ process([], #request{method = 'GET', data = <<>>}) ->
{200, ?HEADER(?CT_XML), get_human_html_xmlel()};
process([], #request{method = 'OPTIONS', data = <<>>}) ->
{200, ?OPTIONS_HEADER, []};
process(_Path, _Request) ->
?DEBUG("Bad Request: ~p", [_Request]),
process(_Path, Request) ->
?DEBUG("Bad Request: ~p", [Request]),
{400, ?HEADER(?CT_XML),
#xmlel{name = <<"h1">>, attrs = [],
children = [{xmlcdata, <<"400 Bad Request">>}]}}.

View File

@ -139,8 +139,8 @@ handle_call(Request, From, State) ->
?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
{noreply, State}.
handle_cast(_Msg, State) ->
?WARNING_MSG("Unexpected cast = ~p", [_Msg]),
handle_cast(Msg, State) ->
?WARNING_MSG("Unexpected cast = ~p", [Msg]),
{noreply, State}.
handle_info(clean, State) ->
@ -151,8 +151,8 @@ handle_info(clean, State) ->
ets:fun2ms(fun({_, _, UnbanTS, _}) -> UnbanTS =< Now end)),
erlang:send_after(?CLEAN_INTERVAL, self(), clean),
{noreply, State};
handle_info(_Info, State) ->
?WARNING_MSG("Unexpected info = ~p", [_Info]),
handle_info(Info, State) ->
?WARNING_MSG("Unexpected info = ~p", [Info]),
{noreply, State}.
terminate(_Reason, #state{host = Host}) ->

View File

@ -386,8 +386,8 @@ process([<<"federation">>, <<"v2">>, <<"send_join">>, RoomID, EventID],
{result, HTTPResult} ->
HTTPResult
end;
process(_Path, _Request) ->
?DEBUG("matrix 404: ~p~n~p~n", [_Path, _Request]),
process(Path, Request) ->
?DEBUG("matrix 404: ~p~n~p~n", [Path, Request]),
ejabberd_web:error(not_found).
preprocess_federation_request(Request) ->

View File

@ -127,8 +127,8 @@ remove_old_messages(Days, LServer) ->
of
{updated, N} ->
?INFO_MSG("~p message(s) deleted from offline spool", [N]);
_Error ->
?ERROR_MSG("Cannot delete message in offline spool: ~p", [_Error])
Error ->
?ERROR_MSG("Cannot delete message in offline spool: ~p", [Error])
end,
{atomic, ok}.

View File

@ -340,16 +340,16 @@ update_roster_sql({LUser, LServer, SJID, Name, SSubscription, SAsk, AskMessage},
raw_to_record(LServer,
[User, LServer, SJID, Nick, SSubscription, SAsk, SAskMessage,
_SServer, _SSubscribe, _SType]) ->
SServer, SSubscribe, SType]) ->
raw_to_record(LServer,
{User, LServer, SJID, Nick, SSubscription, SAsk, SAskMessage,
_SServer, _SSubscribe, _SType});
SServer, SSubscribe, SType});
raw_to_record(LServer,
{User, SJID, Nick, SSubscription, SAsk, SAskMessage,
_SServer, _SSubscribe, _SType}) ->
SServer, SSubscribe, SType}) ->
raw_to_record(LServer,
{User, LServer, SJID, Nick, SSubscription, SAsk, SAskMessage,
_SServer, _SSubscribe, _SType});
SServer, SSubscribe, SType});
raw_to_record(LServer,
{User, LServer, SJID, Nick, SSubscription, SAsk, SAskMessage,
_SServer, _SSubscribe, _SType}) ->