Update Elvis to 4.1.1, fix some warnings and enable their tests

This commit is contained in:
Badlop
2025-06-16 13:41:30 +02:00
parent 71f623ddbf
commit 2d2b98e525
9 changed files with 18 additions and 22 deletions
+1
View File
@@ -120,6 +120,7 @@ jobs:
- run: make dialyzer
- run: make test-eunit
- run: make elvis
if: matrix.otp >= '26'
- name: Check Production Release
run: |
+3 -3
View File
@@ -16,17 +16,17 @@
{elvis_style, function_naming_convention, disable},
{elvis_style, god_modules, #{limit => 300}},
{elvis_style, invalid_dynamic_call, disable},
{elvis_style, macro_module_names, disable},
{elvis_style, macro_names, disable},
{elvis_style, max_function_arity, disable}, % #{max_arity => 15}},
{elvis_style, nesting_level, disable},
{elvis_style, no_author, disable},
{elvis_style, no_boolean_in_comparison, disable},
{elvis_style, no_catch_expressions, disable},
{elvis_style, no_debug_call, disable},
{elvis_style, no_if_expression, disable},
{elvis_style, no_import, disable},
{elvis_style, no_match_in_condition, disable},
{elvis_style, no_nested_try_catch, disable},
{elvis_style, no_operation_on_same_value, disable},
{elvis_style, no_receive_without_timeout, disable},
{elvis_style, no_single_clause_case, disable},
{elvis_style, no_spec_with_records, disable},
{elvis_style, no_throw, disable},
+1 -1
View File
@@ -165,7 +165,7 @@
}]}}.
{if_rebar3, {project_plugins, [configure_deps,
{if_var_true, tools, rebar3_format},
{if_var_true, tools, rebar3_lint}
{if_var_true, tools, {rebar3_lint, "4.1.1"}}
]}}.
{if_not_rebar3, {plugins, [
deps_erl_opts, override_deps_versions2, override_opts, configure_deps
+3 -4
View File
@@ -423,9 +423,8 @@ count_users(Server, Opts) ->
-spec get_password(binary(), binary()) -> false | [password()].
get_password(User, Server) ->
case get_password_with_authmodule(User, Server) of
{Passwords, _} -> Passwords
end.
{Passwords, _} = get_password_with_authmodule(User, Server),
Passwords.
-spec get_password_s(binary(), binary()) -> password().
get_password_s(User, Server) ->
@@ -815,7 +814,7 @@ db_user_exists(User, Server, Mod) ->
end,
case Val of
{ok, _} ->
{true, Mod /= ejabberd_auth_anonymous} ;
{true, Mod /= ejabberd_auth_anonymous};
not_found ->
{false, Mod /= ejabberd_auth_anonymous};
error ->
+2 -3
View File
@@ -170,9 +170,8 @@ send_file(State, Fd, Size, FileName) ->
try
case State#state.sockmod of
gen_tcp ->
case file:sendfile(Fd, State#state.socket, 0, Size, []) of
{ok, _} -> ok
end;
{ok, _} = file:sendfile(Fd, State#state.socket, 0, Size, []),
ok;
_ ->
case file:read(Fd, ?SEND_BUF) of
{ok, Data} ->
+3 -3
View File
@@ -297,11 +297,11 @@ maybe_delete_udsocket_file(_Port) ->
split_opts(Transport, Opts) ->
maps:fold(
fun(Opt, Val, {ModOpts, SockOpts}) ->
case OptVal = {Opt, Val} of
case {Opt, Val} of
{ip, _} ->
{ModOpts, [OptVal|SockOpts]};
{ModOpts, [{Opt, Val} | SockOpts]};
{backlog, _} when Transport == tcp ->
{ModOpts, [OptVal|SockOpts]};
{ModOpts, [{Opt, Val} | SockOpts]};
{backlog, _} ->
{ModOpts, SockOpts};
_ ->
+2 -3
View File
@@ -2230,9 +2230,8 @@ find_services_validate(Global, _Name) when Global == global;
Global == <<"global">> ->
find_services(Global);
find_services_validate(Service, Name) ->
case validate_muc(Service, Name) of
Service2 -> find_services(Service2)
end.
Service2 = validate_muc(Service, Name),
find_services(Service2).
find_services(Global) when Global == global;
Global == <<"global">> ->
+2 -4
View File
@@ -112,10 +112,8 @@ c2s_handle_sasl2_task_data({_, #{user := User, server := Server,
serverkey = ServerKey, storedkey = StoredKey}),
State2 = maps:remove(scram_upgrade, State),
InlineEls2 = lists:keydelete(sasl_upgrade, 1, InlineEls),
case ejabberd_c2s:handle_sasl2_inline(InlineEls2, State2) of
{State3, NewEls, Results} ->
{success, NewEls, Results, State3}
end;
{State3, NewEls, Results} = ejabberd_c2s:handle_sasl2_inline(InlineEls2, State2),
{success, NewEls, Results, State3};
_ ->
{abort, State}
end.
+1 -1
View File
@@ -56,7 +56,7 @@ delete_subscription(SubID) ->
"where subid = %(SubID)s")),
ok.
-spec update_subscription(#pubsub_subscription{}) -> ok .
-spec update_subscription(#pubsub_subscription{}) -> ok.
update_subscription(#pubsub_subscription{subid = SubId} = Sub) ->
delete_subscription(SubId), add_subscription(Sub).