Cleanup dialyzer calls

- Use the same base .plt everywhere, so there is no need to list
standard apps everywhere
- Fix typespecs: some typos and the use of not-exported types
This commit is contained in:
Alexey Lebedeff 2023-02-06 16:53:27 +01:00
parent 3b5ec6a496
commit c7da0da8b8
35 changed files with 75 additions and 31 deletions

View File

@ -2,6 +2,7 @@ load("@rules_erlang//:xref2.bzl", "xref")
load("@rules_erlang//:dialyze.bzl", "dialyze", "plt")
load(
"//:rabbitmq.bzl",
"RABBITMQ_DIALYZER_OPTS",
"assert_suites",
"broker_for_integration_suites",
"rabbitmq_app",
@ -36,6 +37,7 @@ APP_EXTRA_KEYS = """%% Hex.pm package informations.
"""
EXTRA_APPS = [
"public_key",
"ssl",
"inets",
"crypto",
@ -70,6 +72,7 @@ plt(
dialyze(
plt = ":base_plt",
dialyzer_opts = RABBITMQ_DIALYZER_OPTS,
)
broker_for_integration_suites(

View File

@ -2,6 +2,7 @@ load("@rules_erlang//:xref2.bzl", "xref")
load("@rules_erlang//:dialyze.bzl", "dialyze")
load(
"//:rabbitmq.bzl",
"RABBITMQ_DIALYZER_OPTS",
"assert_suites",
"rabbitmq_app",
"rabbitmq_suite",
@ -73,6 +74,7 @@ xref()
dialyze(
plt = "//:base_plt",
dialyzer_opts = RABBITMQ_DIALYZER_OPTS,
)
rabbitmq_suite(

View File

@ -1,6 +1,12 @@
load("@rules_erlang//:xref2.bzl", "xref")
load("@rules_erlang//:dialyze.bzl", "dialyze", "plt")
load("//:rabbitmq.bzl", "APP_VERSION", "rabbitmq_app", "rabbitmq_suite")
load(
"//:rabbitmq.bzl",
"RABBITMQ_DIALYZER_OPTS",
"APP_VERSION",
"rabbitmq_app",
"rabbitmq_suite",
)
APP_NAME = "rabbitmq_prelaunch"
@ -45,6 +51,7 @@ plt(
dialyze(
plt = ":base_plt",
dialyzer_opts = RABBITMQ_DIALYZER_OPTS,
)
suites = [

View File

@ -214,7 +214,7 @@ cancel(Q, ConsumerTag, OkMsg, ActingUser, State) ->
Err -> Err
end.
-spec settle(rabbit_amqqueue:name(), rarabbit_queue_type:settle_op(),
-spec settle(rabbit_amqqueue:name(), rabbit_queue_type:settle_op(),
rabbit_types:ctag(), [non_neg_integer()], state()) ->
{state(), rabbit_queue_type:actions()}.
settle(_QName, complete, _CTag, MsgIds, State) ->

View File

@ -214,7 +214,7 @@ tcp_listener_spec(NamePrefix, Address, SocketOpts,
-spec tcp_listener_spec
(name_prefix(), address(), [gen_tcp:listen_option()], module(), module(),
any(), protocol(), non_neg_integer(), non_neg_integer(), supervisor:worker(), label()) ->
any(), protocol(), non_neg_integer(), non_neg_integer(), 'supervisor' | 'worker', label()) ->
supervisor:child_spec().
tcp_listener_spec(NamePrefix, {IPAddress, Port, Family}, SocketOpts,

View File

@ -147,7 +147,7 @@ update(Q, State) when ?amqqueue_is_quorum(Q) ->
%% QQ state maintains it's own updates
State.
-spec handle_event(rabbit_amqquue:name(),
-spec handle_event(rabbit_amqqueue:name(),
{amqqueue:ra_server_id(), any()},
rabbit_fifo_client:state()) ->
{ok, rabbit_fifo_client:state(), rabbit_queue_type:actions()} |

View File

@ -74,7 +74,11 @@ ensure_secondary_index(Table, Field) ->
{aborted, {already_exists, Table, _}} -> ok
end.
-spec ensure_table_copy(mnesia:table(), node(), mnesia:storage_type()) ->
%% mnesia:table() and mnesia:storage_type() are not exported
-type mnesia_table() :: atom().
-type mnesia_storage_type() :: 'ram_copies' | 'disc_copies' | 'disc_only_copies'.
-spec ensure_table_copy(mnesia_table(), node(), mnesia_storage_type()) ->
ok | {error, any()}.
ensure_table_copy(TableName, Node, StorageType) ->
rabbit_log:debug("Will add a local schema database copy for table '~ts'", [TableName]),
@ -239,7 +243,7 @@ create_local_copies(Type) ->
end, definitions(Type)),
ok.
-spec create_local_copy(mnesia:table(), mnesia:storage_type()) -> ok.
-spec create_local_copy(mnesia_table(), mnesia_storage_type()) -> ok.
create_local_copy(Tab, Type) ->
StorageType = mnesia:table_info(Tab, storage_type),
{atomic, ok} =

View File

@ -23,7 +23,7 @@
-spec start_link
(inet:ip_address(), inet:port_number(), module(), [gen_tcp:listen_option()],
module(), any(), mfargs(), mfargs(), integer(), integer(), supervisor:worker(), string()) ->
module(), any(), mfargs(), mfargs(), integer(), integer(), 'worker' | 'supervisor', string()) ->
rabbit_types:ok_pid_or_error().
start_link(IPAddress, Port, Transport, SocketOpts, ProtoSup, ProtoOpts, OnStartup, OnShutdown,

View File

@ -41,12 +41,17 @@ decrypt_term(Cipher, Hash, Iterations, PassPhrase, {encrypted, _Base64Binary}=En
-type encryption_result() :: {'encrypted', binary()} | {'plaintext', binary()}.
-spec encrypt(crypto:block_cipher(), crypto:hash_algorithms(),
%% crypto:cipher() and crypto:hash_algorithm() are not public
-type crypto_cipher() :: atom().
-type crypto_hash_algorithm() :: atom().
-spec encrypt(crypto_cipher(), crypto_hash_algorithm(),
pos_integer(), iodata() | '$pending-secret', binary()) -> encryption_result().
encrypt(Cipher, Hash, Iterations, PassPhrase, ClearText) ->
credentials_obfuscation_pbe:encrypt(Cipher, Hash, Iterations, PassPhrase, ClearText).
-spec decrypt(crypto:block_cipher(), crypto:hash_algorithms(),
-spec decrypt(crypto_cipher(), crypto_hash_algorithm(),
pos_integer(), iodata(), encryption_result()) -> any().
decrypt(_Cipher, _Hash, _Iterations, _PassPhrase, {plaintext, Term}) ->
Term;

View File

@ -52,10 +52,8 @@ xref(
plt(
name = "base_plt",
plt = "//:base_plt",
apps = [
"erts",
"kernel",
"stdlib",
"ssl",
],
libs = ["//deps/rabbitmq_cli:elixir"],

View File

@ -47,6 +47,7 @@ xref()
plt(
name = "base_plt",
plt = "//:base_plt",
deps = DEPS,
)

View File

@ -42,6 +42,8 @@ xref(
plt(
name = "base_plt",
plt = "//:base_plt",
apps = ["mnesia"],
libs = ["//deps/rabbitmq_cli:elixir"],
deps = ["//deps/rabbitmq_cli:elixir"] + BUILD_DEPS + DEPS,
)

View File

@ -26,10 +26,10 @@ setup_schema() ->
}).
setup_schema_in_mnesia() ->
mnesia:create_table(?HASH_RING_STATE_TABLE, [{record_name, chx_hash_ring},
_ = mnesia:create_table(?HASH_RING_STATE_TABLE, [{record_name, chx_hash_ring},
{attributes, record_info(fields, chx_hash_ring)},
{type, ordered_set}]),
mnesia:add_table_copy(?HASH_RING_STATE_TABLE, node(), ram_copies),
_ = mnesia:add_table_copy(?HASH_RING_STATE_TABLE, node(), ram_copies),
rabbit_table:wait([?HASH_RING_STATE_TABLE]).
create(X) ->

View File

@ -31,6 +31,7 @@ xref()
plt(
name = "base_plt",
plt = "//:base_plt",
deps = DEPS,
)

View File

@ -49,6 +49,7 @@ xref(
plt(
name = "base_plt",
plt = "//:base_plt",
libs = ["//deps/rabbitmq_cli:elixir"],
deps = ["//deps/rabbitmq_cli:elixir"] + BUILD_DEPS + DEPS,
)

View File

@ -45,6 +45,7 @@ xref()
plt(
name = "base_plt",
plt = "//:base_plt",
deps = BUILD_DEPS + DEPS,
)

View File

@ -77,11 +77,8 @@ xref()
plt(
name = "base_plt",
apps = [
"erts",
"kernel",
"stdlib",
] + EXTRA_APPS,
plt = "//:base_plt",
apps = EXTRA_APPS,
deps = DEPS + RUNTIME_DEPS,
)

View File

@ -74,7 +74,6 @@ plt(
dialyze(
dialyzer_opts = RABBITMQ_DIALYZER_OPTS,
plt = ":base_plt",
warnings_as_errors = False,
)
broker_for_integration_suites()

View File

@ -37,6 +37,7 @@ xref()
plt(
name = "base_plt",
plt = "//:base_plt",
deps = DEPS,
)

View File

@ -37,6 +37,7 @@ xref()
plt(
name = "base_plt",
plt = "//:base_plt",
deps = DEPS,
)

View File

@ -46,6 +46,7 @@ xref()
plt(
name = "base_plt",
plt = "//:base_plt",
deps = BUILD_DEPS + DEPS + RUNTIME_DEPS,
)

View File

@ -36,6 +36,7 @@ xref()
plt(
name = "base_plt",
deps = BUILD_DEPS + DEPS,
plt = "//:base_plt",
)
dialyze(

View File

@ -30,13 +30,13 @@ xref()
plt(
name = "base_plt",
plt = "//:base_plt",
deps = DEPS,
)
dialyze(
dialyzer_opts = RABBITMQ_DIALYZER_OPTS,
plt = ":base_plt",
warnings_as_errors = False,
)
broker_for_integration_suites()

View File

@ -65,6 +65,8 @@ xref(
plt(
name = "base_plt",
plt = "//:base_plt",
apps = EXTRA_APPS,
libs = ["//deps/rabbitmq_cli:elixir"],
deps = ["//deps/rabbitmq_cli:elixir"] + BUILD_DEPS + DEPS + RUNTIME_DEPS,
)

View File

@ -44,6 +44,7 @@ xref()
plt(
name = "base_plt",
plt = "//:base_plt",
deps = BUILD_DEPS + DEPS,
)

View File

@ -71,6 +71,7 @@ xref(
plt(
name = "base_plt",
plt = "//:base_plt",
libs = ["//deps/rabbitmq_cli:elixir"],
deps = ["//deps/rabbitmq_cli:elixir"] + BUILD_DEPS + DEPS + RUNTIME_DEPS,
)

View File

@ -61,10 +61,8 @@ xref(
plt(
name = "base_plt",
plt = "//:base_plt",
apps = [
"erts",
"kernel",
"stdlib",
"ssl",
],
libs = ["//deps/rabbitmq_cli:elixir"],

View File

@ -40,6 +40,7 @@ xref()
plt(
name = "base_plt",
plt = "//:base_plt",
deps = BUILD_DEPS + DEPS,
)

View File

@ -42,6 +42,7 @@ xref()
plt(
name = "base_plt",
plt = "//:base_plt",
deps = BUILD_DEPS + DEPS,
)

View File

@ -51,6 +51,7 @@ xref()
plt(
name = "base_plt",
plt = "//:base_plt",
deps = BUILD_DEPS + DEPS,
)

View File

@ -25,6 +25,7 @@ EXTRA_APPS = [
"ssl",
"crypto",
"public_key",
"inets",
]
DEPS = [
@ -51,7 +52,7 @@ plt(
name = "base_plt",
apps = EXTRA_APPS,
plt = "//:base_plt",
deps = DEPS,
deps = DEPS + RUNTIME_DEPS,
)
dialyze(

View File

@ -18,11 +18,11 @@
-record(http_state,{
url :: string(),
http_options :: list(),
headers :: httpc:headers()
headers :: [{[byte()], binary() | iolist()}]
}).
list_certs(Config) ->
init(Config),
_ = init(Config),
State = init_state(Config),
list_certs(Config, State).

View File

@ -1,5 +1,5 @@
load("@rules_erlang//:xref2.bzl", "xref")
load("@rules_erlang//:dialyze.bzl", "dialyze")
load("@rules_erlang//:dialyze.bzl", "dialyze", "plt")
load(
"//:rabbitmq.bzl",
"RABBITMQ_DIALYZER_OPTS",
@ -34,9 +34,15 @@ rabbitmq_app(
xref()
plt(
name = "base_plt",
plt = "//:base_plt",
deps = RUNTIME_DEPS,
)
dialyze(
dialyzer_opts = RABBITMQ_DIALYZER_OPTS,
plt = "//:base_plt",
plt = ":base_plt",
)
alias(

View File

@ -60,6 +60,7 @@ xref()
plt(
name = "base_plt",
plt = "//:base_plt",
deps = BUILD_DEPS + DEPS,
)

View File

@ -1,5 +1,5 @@
load("@rules_erlang//:xref2.bzl", "xref")
load("@rules_erlang//:dialyze.bzl", "dialyze")
load("@rules_erlang//:dialyze.bzl", "dialyze", "plt")
load(
"//:rabbitmq.bzl",
"RABBITMQ_DIALYZER_OPTS",
@ -34,9 +34,15 @@ rabbitmq_app(
xref()
plt(
name = "base_plt",
plt = "//:base_plt",
deps = RUNTIME_DEPS,
)
dialyze(
dialyzer_opts = RABBITMQ_DIALYZER_OPTS,
plt = "//:base_plt",
plt = ":base_plt",
)
alias(