Skip to content

Commit 0a35255

Browse files
the-mikedavismichaelklishin
authored andcommitted
Resolve elixirc warnings
* Remove unused aliases/imports * Remove or underscore unused bindings * Fix variables that should be atoms (`unavailable` -> `:unavailable`) Also, `Logger.warn/1` has been replaced by `Logger.warning/1`. It should be safe to just replace the call with `Logger.warning/1` since it's been in the standard library since Elixir 1.11.
1 parent c40b57a commit 0a35255

12 files changed

+15
-35
lines changed

deps/rabbitmq_cli/lib/rabbitmq/cli/core/command_modules.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ defmodule RabbitMQ.CLI.Core.CommandModules do
6969
{:ok, enabled_plugins_file} = PluginsHelpers.enabled_plugins_file(opts)
7070
require Logger
7171

72-
Logger.warn(
72+
Logger.warning(
7373
"Unable to read the enabled plugins file.\n" <>
7474
" Reason: #{inspect(err)}\n" <>
7575
" Commands provided by plugins will not be available.\n" <>

deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/add_user_command.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.AddUserCommand do
8383

8484
def run(
8585
[username, base64_encoded_password_hash],
86-
%{node: node_name, pre_hashed_password: true} = opts
86+
%{node: node_name, pre_hashed_password: true}
8787
) do
8888
case Base.decode64(base64_encoded_password_hash) do
8989
{:ok, password_hash} ->

deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/force_standalone_khepri_boot.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
## Copyright (c) 2007-2023 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
66

77
defmodule RabbitMQ.CLI.Ctl.Commands.ForceStandaloneKhepriBootCommand do
8-
alias RabbitMQ.CLI.Core.{Config, DocGuide}
8+
alias RabbitMQ.CLI.Core.DocGuide
99

1010
@behaviour RabbitMQ.CLI.CommandBehaviour
1111

1212
use RabbitMQ.CLI.Core.MergesNoDefaults
1313
use RabbitMQ.CLI.Core.AcceptsNoPositionalArguments
1414

15-
def run([], %{node: node_name} = opts) do
15+
def run([], %{node: node_name}) do
1616
ret =
1717
:rabbit_misc.rpc_call(node_name, :rabbit_khepri, :force_shrink_member_to_current_member, [])
1818

deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/forget_cluster_node_command.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ForgetClusterNodeCommand do
7272
{:error,
7373
"RabbitMQ on node #{node_to_remove} must be stopped with 'rabbitmqctl -n #{node_to_remove} stop_app' before it can be removed"}
7474

75-
{:error, {:failed_to_remove_node, ^atom_name, unavailable}} ->
75+
{:error, {:failed_to_remove_node, ^atom_name, :unavailable}} ->
7676
{:error, "Node #{node_to_remove} must be running before it can be removed"}
7777

7878
{:error, _} = error ->

deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/join_cluster_command.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.JoinClusterCommand do
7676
"Error: cannot cluster node with itself: #{node_name}"}
7777
end
7878

79-
def output({:error, {:node_type_unsupported, db, node_type}}, %{node: node_name}) do
79+
def output({:error, {:node_type_unsupported, db, node_type}}, %{node: _node_name}) do
8080
{:error, RabbitMQ.CLI.Core.ExitCodes.exit_software(),
8181
"Error: `#{node_type}` node type is unsupported by the #{db} by database engine"}
8282
end

deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/rename_cluster_node_command.ex

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
defmodule RabbitMQ.CLI.Ctl.Commands.RenameClusterNodeCommand do
88
require Integer
9-
alias RabbitMQ.CLI.Core.{DocGuide, Validators}
10-
import RabbitMQ.CLI.Core.DataCoercion
9+
alias RabbitMQ.CLI.Core.DocGuide
1110

1211
@behaviour RabbitMQ.CLI.CommandBehaviour
1312

@@ -21,7 +20,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.RenameClusterNodeCommand do
2120
:ok
2221
end
2322

24-
def run(nodes, %{node: node_name}) do
23+
def run(_nodes, %{node: _node_name}) do
2524
:ok
2625
end
2726

deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/update_cluster_nodes_command.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
## Copyright (c) 2007-2024 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
66

77
defmodule RabbitMQ.CLI.Ctl.Commands.UpdateClusterNodesCommand do
8-
alias RabbitMQ.CLI.Core.{Config, DocGuide, Helpers}
8+
alias RabbitMQ.CLI.Core.DocGuide
99

1010
@behaviour RabbitMQ.CLI.CommandBehaviour
1111

deps/rabbitmq_cli/lib/rabbitmq/cli/diagnostics/commands/check_if_any_deprecated_features_are_used_command.ex

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55
## Copyright (c) 2007-2023 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
66

77
defmodule RabbitMQ.CLI.Diagnostics.Commands.CheckIfAnyDeprecatedFeaturesAreUsedCommand do
8-
alias RabbitMQ.CLI.Core.DocGuide
9-
10-
alias RabbitMQ.CLI.Diagnostics.Commands.{
11-
CheckIfClusterHasClassicQueueMirroringPolicyCommand
12-
}
13-
148
@behaviour RabbitMQ.CLI.CommandBehaviour
159

1610
def scopes(), do: [:ctl, :diagnostics]
@@ -100,16 +94,5 @@ defmodule RabbitMQ.CLI.Diagnostics.Commands.CheckIfAnyDeprecatedFeaturesAreUsedC
10094
def description(),
10195
do: "Generate a report listing all deprecated features in use"
10296

103-
def banner(_, %{node: node_name}), do: "Checking if any deprecated features are used ..."
104-
105-
#
106-
# Implementation
107-
#
108-
109-
defp run_command(command, args, opts) do
110-
{args, opts} = command.merge_defaults(args, opts)
111-
banner = command.banner(args, opts)
112-
command_result = command.run(args, opts) |> command.output(opts)
113-
{command, banner, command_result}
114-
end
97+
def banner(_, %{node: _node_name}), do: "Checking if any deprecated features are used ..."
11598
end

deps/rabbitmq_cli/lib/rabbitmq/cli/diagnostics/commands/list_policies_that_match.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,16 @@ defmodule RabbitMQ.CLI.Diagnostics.Commands.ListPoliciesThatMatchCommand do
5656
end
5757
end
5858

59-
def output([], %{node: node_name, formatter: "json"}) do
59+
def output([], %{node: _node_name, formatter: "json"}) do
6060
{:ok, %{"result" => "ok", "policies" => []}}
6161
end
6262

63-
def output({:error, :not_found}, %{node: node_name, formatter: "json"}) do
63+
def output({:error, :not_found}, %{node: _node_name, formatter: "json"}) do
6464
{:ok,
6565
%{"result" => "error", "message" => "object (queue, exchange) not found", "policies" => []}}
6666
end
6767

68-
def output(value, %{node: node_name, formatter: "json"}) when is_list(value) do
68+
def output(value, %{node: _node_name, formatter: "json"}) when is_list(value) do
6969
{:ok, %{"result" => "ok", "policies" => value}}
7070
end
7171

deps/rabbitmq_cli/lib/rabbitmq/cli/diagnostics/commands/metadata_store_status_command.ex

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
## Copyright (c) 2022 VMware, Inc. or its affiliates. All rights reserved.
66

77
defmodule RabbitMQ.CLI.Diagnostics.Commands.MetadataStoreStatusCommand do
8-
alias RabbitMQ.CLI.Core.DocGuide
9-
108
@behaviour RabbitMQ.CLI.CommandBehaviour
119
def scopes(), do: [:diagnostics]
1210

deps/rabbitmq_cli/lib/rabbitmq/cli/diagnostics/commands/remote_shell_command.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ defmodule RabbitMQ.CLI.Diagnostics.Commands.RemoteShellCommand do
3838
case :shell.start_interactive({node_name, {:shell, :start, []}}) do
3939
:ok -> :ok
4040
{:error, :already_started} -> :ok
41-
{error, _} -> {:error, {:badrpc, :nodedown}}
41+
{:error, _} -> {:error, {:badrpc, :nodedown}}
4242
end
4343

4444
:timer.sleep(:infinity)

deps/rabbitmq_cli/lib/rabbitmq/cli/streams/commands/coordinator_status_command.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ defmodule RabbitMQ.CLI.Queues.Commands.CoordinatorStatusCommand do
4747

4848
def description(), do: "Displays raft status of the stream coordinator"
4949

50-
def banner([], %{node: node_name}),
50+
def banner([], %{node: _node_name}),
5151
do: "Status of stream coordinator ..."
5252
end

0 commit comments

Comments
 (0)