diff --git a/apps/emqx/src/emqx_config_handler.erl b/apps/emqx/src/emqx_config_handler.erl
index 045e063de..6f8740ba8 100644
--- a/apps/emqx/src/emqx_config_handler.erl
+++ b/apps/emqx/src/emqx_config_handler.erl
@@ -260,17 +260,20 @@ call_pre_config_update(#{?MOD := HandlerName}, OldRawConf, UpdateReq, ConfKeyPat
call_pre_config_update(_Handlers, OldRawConf, UpdateReq, _ConfKeyPath) ->
merge_to_old_config(UpdateReq, OldRawConf).
-call_post_config_update(#{?MOD := HandlerName}, OldConf, NewConf, AppEnvs, UpdateReq, Result, ConfKeyPath) ->
+call_post_config_update(#{?MOD := HandlerName}, OldConf, NewConf,
+ AppEnvs, UpdateReq, Result, ConfKeyPath) ->
case erlang:function_exported(HandlerName, post_config_update, 5) of
true ->
- case HandlerName:post_config_update(ConfKeyPath, UpdateReq, NewConf, OldConf, AppEnvs) of
+ case HandlerName:post_config_update(ConfKeyPath, UpdateReq,
+ NewConf, OldConf, AppEnvs) of
ok -> {ok, Result};
{ok, Result1} -> {ok, Result#{HandlerName => Result1}};
{error, Reason} -> {error, {post_config_update, HandlerName, Reason}}
end;
false -> {ok, Result}
end;
-call_post_config_update(_Handlers, _OldConf, _NewConf, _AppEnvs, _UpdateReq, Result, _ConfKeyPath) ->
+call_post_config_update(_Handlers, _OldConf, _NewConf, _AppEnvs,
+ _UpdateReq, Result, _ConfKeyPath) ->
{ok, Result}.
save_configs(ConfKeyPath, AppEnvs, CheckedConf, NewRawConf, OverrideConf, UpdateArgs, Opts) ->
diff --git a/apps/emqx/src/emqx_map_lib.erl b/apps/emqx/src/emqx_map_lib.erl
index 8c8af5dab..ba3482f2f 100644
--- a/apps/emqx/src/emqx_map_lib.erl
+++ b/apps/emqx/src/emqx_map_lib.erl
@@ -61,8 +61,8 @@ deep_find([Key | KeyPath] = Path, Map) when is_map(Map) ->
{ok, SubMap} -> deep_find(KeyPath, SubMap);
error -> {not_found, Path, Map}
end;
-deep_find(_KeyPath, Data) ->
- {not_found, _KeyPath, Data}.
+deep_find(KeyPath, Data) ->
+ {not_found, KeyPath, Data}.
-spec deep_put(config_key_path(), map(), term()) -> map().
deep_put([], _Map, Data) ->
diff --git a/apps/emqx/src/emqx_schema.erl b/apps/emqx/src/emqx_schema.erl
index a92c3da67..8bc3d7b29 100644
--- a/apps/emqx/src/emqx_schema.erl
+++ b/apps/emqx/src/emqx_schema.erl
@@ -21,6 +21,7 @@
-dialyzer(no_contracts).
-dialyzer(no_unused).
-dialyzer(no_fail_call).
+-elvis([{elvis_style, invalid_dynamic_call, disable}]).
-include("emqx_authentication.hrl").
-include_lib("typerefl/include/types.hrl").
@@ -382,7 +383,8 @@ after idling for 'Keepalive * backoff * 2'."""
, {"max_inflight",
sc(range(1, 65535),
#{ default => 32,
- desc => "Maximum size of the Inflight Window storing QoS1/2 messages delivered but un-acked."
+ desc => "Maximum size of the Inflight Window storing QoS1/2"
+ " messages delivered but un-acked."
})
}
, {"retry_interval",
@@ -400,7 +402,8 @@ after idling for 'Keepalive * backoff * 2'."""
, {"await_rel_timeout",
sc(duration(),
#{ default => "300s",
- desc => "The QoS2 messages (Client -> Broker) will be dropped if awaiting PUBREL timeout."
+ desc => "The QoS2 messages (Client -> Broker) will be dropped"
+ " if awaiting PUBREL timeout."
})
}
, {"session_expiry_interval",
@@ -1099,7 +1102,8 @@ fields("trace") ->
default => text,
desc => """
Determine the format of the payload format in the trace file.
-`text`: Text-based protocol or plain text protocol. It is recommended when payload is JSON encoded.
+`text`: Text-based protocol or plain text protocol.
+ It is recommended when payload is JSON encoded.
`hex`: Binary hexadecimal encode. It is recommended when payload is a custom binary protocol.
`hidden`: payload is obfuscated as `******`
"""
diff --git a/apps/emqx/test/emqx_authentication_SUITE.erl b/apps/emqx/test/emqx_authentication_SUITE.erl
index 77f7e7f9d..434109163 100644
--- a/apps/emqx/test/emqx_authentication_SUITE.erl
+++ b/apps/emqx/test/emqx_authentication_SUITE.erl
@@ -35,7 +35,9 @@
%% Hocon Schema
%%------------------------------------------------------------------------------
-roots() -> [{config, #{type => hoconsc:union([hoconsc:ref(?MODULE, type1), hoconsc:ref(?MODULE, type2)])}}].
+roots() -> [{config, #{type => hoconsc:union([
+ hoconsc:ref(?MODULE, type1),
+ hoconsc:ref(?MODULE, type2)])}}].
fields(type1) ->
[ {mechanism, {enum, ['password-based']}}
diff --git a/apps/emqx_authz/src/emqx_authz_api_sources.erl b/apps/emqx_authz/src/emqx_authz_api_sources.erl
index 78a58126c..51061e551 100644
--- a/apps/emqx_authz/src/emqx_authz_api_sources.erl
+++ b/apps/emqx_authz/src/emqx_authz_api_sources.erl
@@ -83,26 +83,33 @@ schema("/authorization/sources") ->
, get =>
#{ description => <<"List all authorization sources">>
, responses =>
- #{ 200 => mk( array(hoconsc:union([ref(?API_SCHEMA_MODULE, Type) || Type <- authz_sources_types(detailed)]))
+ #{ 200 => mk( array(hoconsc:union(
+ [ref(?API_SCHEMA_MODULE, Type) || Type <- authz_sources_types(detailed)]))
, #{desc => <<"Authorization source">>})
}
}
, post =>
#{ description => <<"Add a new source">>
- , 'requestBody' => mk( hoconsc:union([ref(?API_SCHEMA_MODULE, Type) || Type <- authz_sources_types(detailed)])
+ , 'requestBody' => mk( hoconsc:union(
+ [ref(?API_SCHEMA_MODULE, Type)
+ || Type <- authz_sources_types(detailed)])
, #{desc => <<"Source config">>})
, responses =>
#{ 204 => <<"Authorization source created successfully">>
- , 400 => emqx_dashboard_swagger:error_codes([?BAD_REQUEST], <<"Bad Request">>)
+ , 400 => emqx_dashboard_swagger:error_codes([?BAD_REQUEST],
+ <<"Bad Request">>)
}
}
, put =>
#{ description => <<"Update all sources">>
- , 'requestBody' => mk( array(hoconsc:union([ref(?API_SCHEMA_MODULE, Type) || Type <- authz_sources_types(detailed)]))
+ , 'requestBody' => mk( array(hoconsc:union(
+ [ref(?API_SCHEMA_MODULE, Type)
+ || Type <- authz_sources_types(detailed)]))
, #{desc => <<"Sources">>})
, responses =>
#{ 204 => <<"Authorization source updated successfully">>
- , 400 => emqx_dashboard_swagger:error_codes([?BAD_REQUEST], <<"Bad Request">>)
+ , 400 => emqx_dashboard_swagger:error_codes([?BAD_REQUEST],
+ <<"Bad Request">>)
}
}
};
@@ -112,7 +119,9 @@ schema("/authorization/sources/:type") ->
#{ description => <<"Get a authorization source">>
, parameters => parameters_field()
, responses =>
- #{ 200 => mk( hoconsc:union([ref(?API_SCHEMA_MODULE, Type) || Type <- authz_sources_types(detailed)])
+ #{ 200 => mk( hoconsc:union(
+ [ref(?API_SCHEMA_MODULE, Type)
+ || Type <- authz_sources_types(detailed)])
, #{desc => <<"Authorization source">>})
, 404 => emqx_dashboard_swagger:error_codes([?NOT_FOUND], <<"Not Found">>)
}
@@ -120,7 +129,8 @@ schema("/authorization/sources/:type") ->
, put =>
#{ description => <<"Update source">>
, parameters => parameters_field()
- , 'requestBody' => mk( hoconsc:union([ref(?API_SCHEMA_MODULE, Type) || Type <- authz_sources_types(detailed)]))
+ , 'requestBody' => mk( hoconsc:union([ref(?API_SCHEMA_MODULE, Type)
+ || Type <- authz_sources_types(detailed)]))
, responses =>
#{ 204 => <<"Authorization source updated successfully">>
, 400 => emqx_dashboard_swagger:error_codes([?BAD_REQUEST], <<"Bad Request">>)
diff --git a/apps/emqx_conf/src/emqx_conf_schema.erl b/apps/emqx_conf/src/emqx_conf_schema.erl
index 96c2ed925..1ac8c2703 100644
--- a/apps/emqx_conf/src/emqx_conf_schema.erl
+++ b/apps/emqx_conf/src/emqx_conf_schema.erl
@@ -315,19 +315,22 @@ a crash dump"
sc(emqx_schema:duration(),
#{ mapping => "vm_args.-kernel net_ticktime"
, default => "2m"
- , desc => "This is the approximate time an EMQX node may be unresponsive until it is considered down and thereby disconnected."
+ , desc => "This is the approximate time an EMQX node may"
+ " be unresponsive until it is considered down and thereby disconnected."
})}
, {"dist_listen_min",
sc(range(1024, 65535),
#{ mapping => "kernel.inet_dist_listen_min"
, default => 6369
- , desc => "Lower bound for the port range where EMQX broker listens for peer connections."
+ , desc => "Lower bound for the port range where"
+ " EMQX broker listens for peer connections."
})}
, {"dist_listen_max",
sc(range(1024, 65535),
#{ mapping => "kernel.inet_dist_listen_max"
, default => 6369
- , desc => "Upper bound for the port range where EMQX broker listens for peer connections."
+ , desc => "Upper bound for the port range "
+ "where EMQX broker listens for peer connections."
})}
, {"backtrace_depth",
sc(integer(),
@@ -455,7 +458,8 @@ fields("rpc") ->
#{ mapping => "gen_rpc.port_discovery"
, default => stateless
, desc => "manual
: discover ports by tcp_server_port
.
"
- "stateless
: discover ports in a stateless manner, using the following algorithm. "
+ "stateless
: discover ports in a stateless manner,"
+ " using the following algorithm. "
"If node name is emqxN@127.0.0.1
, where the N is an integer, "
"then the listening port will be 5370 + N."
})}
@@ -464,7 +468,8 @@ fields("rpc") ->
#{ mapping => "gen_rpc.tcp_server_port"
, default => 5369
, desc => "Listening port used by RPC local service.
"
- "Note that this config only takes effect when rpc.port_discovery is set to manual."
+ "Note that this config only takes effect "
+ "when rpc.port_discovery is set to manual."
})}
, {"ssl_server_port",
sc(integer(),
@@ -497,7 +502,8 @@ fields("rpc") ->
sc(file(),
#{ mapping => "gen_rpc.keyfile"
, desc => "Path to the private key file for the rpc.certfile
.
"
- "Note: contents of this file are secret, so it's necessary to set permissions to 600."
+ "Note: contents of this file are secret, so it's necessary to "
+ "set permissions to 600."
})}
, {"cacertfile",
sc(file(),
@@ -528,7 +534,8 @@ fields("rpc") ->
sc(emqx_schema:duration_s(),
#{ mapping => "gen_rpc.socket_keepalive_idle"
, default => "7200s"
- , desc => "How long the connections between the brokers should remain open after the last message is sent."
+ , desc => "How long the connections between the brokers should remain open "
+ "after the last message is sent."
})}
, {"socket_keepalive_interval",
sc(emqx_schema:duration_s(),
diff --git a/apps/emqx_connector/test/emqx_connector_api_SUITE.erl b/apps/emqx_connector/test/emqx_connector_api_SUITE.erl
index b4c14a596..4b7138165 100644
--- a/apps/emqx_connector/test/emqx_connector_api_SUITE.erl
+++ b/apps/emqx_connector/test/emqx_connector_api_SUITE.erl
@@ -91,12 +91,14 @@ init_per_suite(Config) ->
ok = emqx_common_test_helpers:start_apps([emqx_rule_engine, emqx_connector,
emqx_bridge, emqx_dashboard], fun set_special_configs/1),
ok = emqx_common_test_helpers:load_config(emqx_connector_schema, <<"connectors: {}">>),
- ok = emqx_common_test_helpers:load_config(emqx_rule_engine_schema, <<"rule_engine {rules {}}">>),
+ ok = emqx_common_test_helpers:load_config(emqx_rule_engine_schema,
+ <<"rule_engine {rules {}}">>),
ok = emqx_common_test_helpers:load_config(emqx_bridge_schema, ?BRIDGE_CONF_DEFAULT),
Config.
end_per_suite(_Config) ->
- emqx_common_test_helpers:stop_apps([emqx_rule_engine, emqx_connector, emqx_bridge, emqx_dashboard]),
+ emqx_common_test_helpers:stop_apps([emqx_rule_engine,
+ emqx_connector, emqx_bridge, emqx_dashboard]),
ok.
set_special_configs(emqx_dashboard) ->