Skip to content

Commit ca3100d

Browse files
Merge pull request #7122 from rabbitmq/mergify/bp/v3.10.x/pr-7114
Add rabbitmq_cli dialyze to bazel (backport #7066) (backport #7114)
2 parents 332af6c + 624394e commit ca3100d

31 files changed

+101
-51
lines changed

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ bazel_dep(
3131

3232
bazel_dep(
3333
name = "rules_erlang",
34-
version = "3.9.1",
34+
version = "3.9.2",
3535
)
3636

3737
erlang_config = use_extension(

WORKSPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_r
44
git_repository(
55
name = "rules_erlang",
66
remote = "https://github.com/rabbitmq/rules_erlang.git",
7-
tag = "3.9.1",
7+
tag = "3.9.2",
88
)
99

1010
load("@rules_erlang//:internal_deps.bzl", "rules_erlang_internal_deps")

deps/rabbit_common/src/rabbit_misc.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@
229229
-spec pset(term(), term(), [term()]) -> [term()].
230230
-spec format_message_queue(any(), priority_queue:q()) -> term().
231231
-spec os_cmd(string()) -> string().
232-
-spec is_os_process_alive(non_neg_integer()) -> boolean().
232+
-spec is_os_process_alive(non_neg_integer() | string()) -> boolean().
233233
-spec gb_sets_difference(gb_sets:set(), gb_sets:set()) -> gb_sets:set().
234234
-spec version() -> string().
235235
-spec otp_release() -> string().

deps/rabbitmq_cli/BUILD.bazel

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
load("@bazel_skylib//rules:select_file.bzl", "select_file")
2+
load("@rules_erlang//:dialyze.bzl", "dialyze", "plt")
23
load(":rabbitmqctl.bzl", "rabbitmqctl")
34
load(":rabbitmqctl_check_formatted.bzl", "rabbitmqctl_check_formatted_test")
45
load(":rabbitmqctl_test.bzl", "rabbitmqctl_test")
56
load("//:rabbitmq_home.bzl", "rabbitmq_home")
67
load("//:rabbitmq_run.bzl", "rabbitmq_run")
7-
load("//:rabbitmq.bzl", "STARTS_BACKGROUND_BROKER_TAG")
8+
load("//:rabbitmq.bzl", "RABBITMQ_DIALYZER_OPTS", "STARTS_BACKGROUND_BROKER_TAG")
89

910
# Note: All the various rabbitmq-* scripts are just copies of rabbitmqctl
1011
rabbitmqctl(
@@ -71,6 +72,22 @@ test_suite(
7172
tests = ["check_formatted"],
7273
)
7374

75+
plt(
76+
name = "deps_plt",
77+
libs = [":elixir"],
78+
deps = [
79+
":elixir",
80+
"//deps/rabbit:erlang_app",
81+
"//deps/rabbit_common:erlang_app",
82+
],
83+
)
84+
85+
dialyze(
86+
dialyzer_opts = RABBITMQ_DIALYZER_OPTS,
87+
libs = [":elixir"],
88+
plt = ":deps_plt",
89+
)
90+
7491
rabbitmqctl_test(
7592
name = "tests",
7693
size = "large",

deps/rabbitmq_cli/lib/rabbitmq/cli/auto_complete.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ defmodule RabbitMQ.CLI.AutoComplete do
1010
# Use the same jaro distance limit as in Elixir's "did you mean?"
1111
@jaro_distance_limit 0.77
1212

13+
@dialyzer :no_unused
14+
1315
@spec complete(String.t(), [String.t()]) :: [String.t()]
1416
def complete(_, []) do
1517
[]

deps/rabbitmq_cli/lib/rabbitmq/cli/command_behaviour.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ defmodule RabbitMQ.CLI.CommandBehaviour do
4747
@callback printer() :: atom()
4848
@callback scopes() :: [atom()] | nil
4949
@callback description() :: String.t()
50-
@callback help_section() :: String.t() | {:plugin, atom()}
50+
@callback help_section() :: String.t() | atom() | {:plugin, atom()}
5151
@callback usage_additional() ::
5252
String.t()
5353
| [String.t()]

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ defmodule RabbitMQ.CLI.Core.CodePath do
1515
val ->
1616
with {:ok, plugins_dir} <- val do
1717
String.split(to_string(plugins_dir), Platform.path_separator())
18-
|> Enum.map(&add_directory_plugins_to_load_path/1)
18+
|> Enum.each(&add_directory_plugins_to_load_path/1)
1919

2020
:ok
2121
end
@@ -99,11 +99,11 @@ defmodule RabbitMQ.CLI.Core.CodePath do
9999
_ ->
100100
case Application.load(:rabbit) do
101101
:ok ->
102-
Code.ensure_loaded(:rabbit_plugins)
102+
_ = Code.ensure_loaded(:rabbit_plugins)
103103
:ok
104104

105105
{:error, {:already_loaded, :rabbit}} ->
106-
Code.ensure_loaded(:rabbit_plugins)
106+
_ = Code.ensure_loaded(:rabbit_plugins)
107107
:ok
108108

109109
{:error, err} ->

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ defmodule RabbitMQ.CLI.Core.CommandModules do
5959
end
6060

6161
def plugin_modules(opts) do
62-
require_rabbit(opts)
62+
_ = require_rabbit(opts)
6363

6464
enabled_plugins =
6565
try do

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ defmodule RabbitMQ.CLI.Core.Helpers do
130130
end
131131

132132
def apply_if_exported(mod, fun, args, default) do
133-
Code.ensure_loaded(mod)
133+
_ = Code.ensure_loaded(mod)
134134

135135
case function_exported?(mod, fun, length(args)) do
136136
true -> apply(mod, fun, args)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ defmodule RabbitMQ.CLI.Core.Input do
2626
end
2727

2828
def consume_multiline_string() do
29-
val = IO.read(:stdio, :all)
29+
val = IO.read(:stdio, :eof)
3030

3131
case val do
3232
:eof -> :eof

0 commit comments

Comments
 (0)