Просмотр исходного кода

fix: format the code to remove extra spaces

Shawn 4 лет назад
Родитель
Сommit
8207090419
34 измененных файлов с 122 добавлено и 124 удалено
  1. 1 1
      apps/emqx/include/emqx.hrl
  2. 1 1
      apps/emqx/src/emqx_limiter/src/emqx_limiter_server.erl
  3. 1 1
      apps/emqx/src/emqx_packet.erl
  4. 3 3
      apps/emqx/src/emqx_pqueue.erl
  5. 1 1
      apps/emqx/src/emqx_session.erl
  6. 2 2
      apps/emqx/src/emqx_sys.erl
  7. 2 2
      apps/emqx/src/emqx_vm.erl
  8. 1 1
      apps/emqx_authn/src/enhanced_authn/emqx_enhanced_authn_scram_mnesia.erl
  9. 6 8
      apps/emqx_authn/src/simple_authn/emqx_authn_http.erl
  10. 19 20
      apps/emqx_authn/src/simple_authn/emqx_authn_jwt.erl
  11. 1 1
      apps/emqx_authn/src/simple_authn/emqx_authn_mnesia.erl
  12. 5 5
      apps/emqx_authn/src/simple_authn/emqx_authn_mongodb.erl
  13. 2 2
      apps/emqx_authn/src/simple_authn/emqx_authn_mysql.erl
  14. 1 1
      apps/emqx_authn/src/simple_authn/emqx_authn_pgsql.erl
  15. 1 1
      apps/emqx_authn/src/simple_authn/emqx_authn_redis.erl
  16. 28 16
      apps/emqx_authz/src/emqx_authz_api_mnesia.erl
  17. 1 1
      apps/emqx_authz/src/emqx_authz_rule.erl
  18. 7 7
      apps/emqx_authz/src/emqx_authz_schema.erl
  19. 0 11
      apps/emqx_authz/src/emqx_authz_sup.erl
  20. 2 2
      apps/emqx_auto_subscribe/src/emqx_auto_subscribe_schema.erl
  21. 2 2
      apps/emqx_conf/src/emqx_conf_cli.erl
  22. 6 6
      apps/emqx_conf/src/emqx_conf_schema.erl
  23. 1 1
      apps/emqx_gateway/src/coap/emqx_coap_impl.erl
  24. 1 1
      apps/emqx_gateway/src/emqx_gateway_api_clients.erl
  25. 1 1
      apps/emqx_gateway/src/lwm2m/emqx_lwm2m_session.erl
  26. 1 1
      apps/emqx_machine/src/emqx_machine_boot.erl
  27. 4 4
      apps/emqx_modules/src/emqx_rewrite.erl
  28. 4 4
      apps/emqx_modules/src/emqx_topic_metrics.erl
  29. 9 9
      apps/emqx_modules/src/emqx_topic_metrics_api.erl
  30. 1 1
      apps/emqx_prometheus/src/emqx_prometheus.erl
  31. 3 3
      apps/emqx_psk/src/emqx_psk_schema.erl
  32. 1 1
      apps/emqx_retainer/src/emqx_retainer_api.erl
  33. 1 1
      apps/emqx_statsd/src/emqx_statsd_schema.erl
  34. 2 2
      deploy/docker/README.md

+ 1 - 1
apps/emqx/include/emqx.hrl

@@ -46,7 +46,7 @@
 -define(SYSTOP, <<"$SYS/">>).
 
 %% Queue topic
--define(QUEUE,  <<"$queue/">>).
+-define(QUEUE, <<"$queue/">>).
 
 %%--------------------------------------------------------------------
 %% alarms

+ 1 - 1
apps/emqx/src/emqx_limiter/src/emqx_limiter_server.erl

@@ -87,7 +87,7 @@
 -define(OVERLOAD_MIN_ALLOC, 0.3).  %% minimum coefficient for overloaded limiter
 
 -export_type([index/0]).
--import(emqx_limiter_decimal, [add/2, sub/2, mul/2,  put_to_counter/3]).
+-import(emqx_limiter_decimal, [add/2, sub/2, mul/2, put_to_counter/3]).
 
 -elvis([{elvis_style, no_if_expression, disable}]).
 

+ 1 - 1
apps/emqx/src/emqx_packet.erl

@@ -177,7 +177,7 @@ info(packet_id, #mqtt_packet_puback{packet_id = PacketId}) ->
     PacketId;
 info(reason_code, #mqtt_packet_puback{reason_code = RC}) ->
     RC;
-info(properties,  #mqtt_packet_puback{properties = Props}) ->
+info(properties, #mqtt_packet_puback{properties = Props}) ->
     Props;
 
 info(packet_id, #mqtt_packet_subscribe{packet_id = PacketId}) ->

+ 3 - 3
apps/emqx/src/emqx_pqueue.erl

@@ -78,7 +78,7 @@ is_queue({queue, R, F, L}) when is_list(R), is_list(F), is_integer(L) ->
     true;
 is_queue({pqueue, Queues}) when is_list(Queues) ->
     lists:all(fun ({infinity, Q}) -> is_queue(Q);
-                  ({P,        Q}) -> is_integer(P) andalso is_queue(Q)
+                  ({P, Q}) -> is_integer(P) andalso is_queue(Q)
               end, Queues);
 is_queue(_) ->
     false.
@@ -268,9 +268,9 @@ highest({queue, [], [], 0})     -> empty;
 highest({queue, _, _, _})       -> 0;
 highest({pqueue, [{P, _} | _]}) -> maybe_negate_priority(P).
 
-r2f([],      0) -> {queue, [], [], 0};
+r2f([], 0) -> {queue, [], [], 0};
 r2f([_] = R, 1) -> {queue, [], R, 1};
-r2f([X,Y],   2) -> {queue, [X], [Y], 2};
+r2f([X,Y], 2) -> {queue, [X], [Y], 2};
 r2f([X,Y|R], L) -> {queue, [X,Y], lists:reverse(R, []), L}.
 
 maybe_negate_priority(infinity) -> infinity;

+ 1 - 1
apps/emqx/src/emqx_session.erl

@@ -697,7 +697,7 @@ resume(ClientInfo = #{clientid := ClientId}, Session = #session{subscriptions =
 
 -spec(replay(emqx_types:clientinfo(), session()) -> {ok, replies(), session()}).
 replay(ClientInfo, Session = #session{inflight = Inflight}) ->
-    Pubs = lists:map(fun({PacketId, {Pubrel,  _Ts}}) when is_record(Pubrel, pubrel_await) ->
+    Pubs = lists:map(fun({PacketId, {Pubrel, _Ts}}) when is_record(Pubrel, pubrel_await) ->
                              {pubrel, PacketId};
                         ({PacketId, {Msg, _Ts}}) ->
                              {PacketId, emqx_message:set_flag(dup, true, Msg)}

+ 2 - 2
apps/emqx/src/emqx_sys.erl

@@ -110,9 +110,9 @@ sys_heatbeat_interval() ->
 %% @doc Get sys info
 -spec(info() -> list(tuple())).
 info() ->
-    [{version,  version()},
+    [{version, version()},
      {sysdescr, sysdescr()},
-     {uptime,   uptime()},
+     {uptime, uptime()},
      {datetime, datetime()}].
 
 %%------------------------------------------------------------------------------

+ 2 - 2
apps/emqx/src/emqx_vm.erl

@@ -166,8 +166,8 @@ schedulers() ->
     erlang:system_info(schedulers).
 
 loads() ->
-    [{load1,  ftos(avg1()/256)},
-     {load5,  ftos(avg5()/256)},
+    [{load1, ftos(avg1()/256)},
+     {load5, ftos(avg5()/256)},
      {load15, ftos(avg15()/256)}
     ].
 

+ 1 - 1
apps/emqx_authn/src/enhanced_authn/emqx_enhanced_authn_scram_mnesia.erl

@@ -88,7 +88,7 @@ roots() -> [?CONF_NS].
 fields(?CONF_NS) ->
     [ {mechanism, emqx_authn_schema:mechanism('scram')}
     , {backend, emqx_authn_schema:backend('built-in-database')}
-    , {algorithm,       fun algorithm/1}
+    , {algorithm, fun algorithm/1}
     , {iteration_count, fun iteration_count/1}
     ] ++ emqx_authn_schema:common_fields().
 

+ 6 - 8
apps/emqx_authn/src/simple_authn/emqx_authn_http.erl

@@ -50,22 +50,20 @@ roots() ->
     ].
 
 fields(get) ->
-    [ {method,          #{type => get,
-                          default => post}}
-    , {headers,         fun headers_no_content_type/1}
+    [ {method, #{type => get, default => post}}
+    , {headers, fun headers_no_content_type/1}
     ] ++ common_fields();
 
 fields(post) ->
-    [ {method,          #{type => post,
-                          default => post}}
-    , {headers,         fun headers/1}
+    [ {method, #{type => post, default => post}}
+    , {headers, fun headers/1}
     ] ++ common_fields().
 
 common_fields() ->
     [ {mechanism, emqx_authn_schema:mechanism('password-based')}
     , {backend, emqx_authn_schema:backend(http)}
-    , {url,             fun url/1}
-    , {body,            fun body/1}
+    , {url, fun url/1}
+    , {body, fun body/1}
     , {request_timeout, fun request_timeout/1}
     ] ++ emqx_authn_schema:common_fields()
     ++ maps:to_list(maps:without([ base_url

+ 19 - 20
apps/emqx_authn/src/simple_authn/emqx_authn_jwt.erl

@@ -48,35 +48,34 @@ roots() ->
     ].
 
 fields('hmac-based') ->
-    [ {use_jwks,              {enum, [false]}}
-    , {algorithm,             {enum, ['hmac-based']}}
-    , {secret,                fun secret/1}
+    [ {use_jwks, {enum, [false]}}
+    , {algorithm, {enum, ['hmac-based']}}
+    , {secret, fun secret/1}
     , {secret_base64_encoded, fun secret_base64_encoded/1}
     ] ++ common_fields();
 
 fields('public-key') ->
-    [ {use_jwks,              {enum, [false]}}
-    , {algorithm,             {enum, ['public-key']}}
-    , {certificate,           fun certificate/1}
+    [ {use_jwks, {enum, [false]}}
+    , {algorithm, {enum, ['public-key']}}
+    , {certificate, fun certificate/1}
     ] ++ common_fields();
 
 fields('jwks') ->
-    [ {use_jwks,              {enum, [true]}}
-    , {endpoint,              fun endpoint/1}
-    , {refresh_interval,      fun refresh_interval/1}
-    , {ssl,                   #{type => hoconsc:union(
-                                         [ hoconsc:ref(?MODULE, ssl_enable)
-                                         , hoconsc:ref(?MODULE, ssl_disable)
-                                         ]),
-                                default => #{<<"enable">> => false}}}
+    [ {use_jwks, {enum, [true]}}
+    , {endpoint, fun endpoint/1}
+    , {refresh_interval, fun refresh_interval/1}
+    , {ssl, #{type => hoconsc:union([ hoconsc:ref(?MODULE, ssl_enable)
+                                    , hoconsc:ref(?MODULE, ssl_disable)
+                                    ]),
+              default => #{<<"enable">> => false}}}
     ] ++ common_fields();
 
 fields(ssl_enable) ->
-    [ {enable,                 #{type => true}}
-    , {cacertfile,             fun cacertfile/1}
-    , {certfile,               fun certfile/1}
-    , {keyfile,                fun keyfile/1}
-    , {verify,                 fun verify/1}
+    [ {enable, #{type => true}}
+    , {cacertfile, fun cacertfile/1}
+    , {certfile, fun certfile/1}
+    , {keyfile, fun keyfile/1}
+    , {verify, fun verify/1}
     , {server_name_indication, fun server_name_indication/1}
     ];
 
@@ -85,7 +84,7 @@ fields(ssl_disable) ->
 
 common_fields() ->
     [ {mechanism, emqx_authn_schema:mechanism('jwt')}
-    , {verify_claims,   fun verify_claims/1}
+    , {verify_claims, fun verify_claims/1}
     ] ++ emqx_authn_schema:common_fields().
 
 secret(type) -> binary();

+ 1 - 1
apps/emqx_authn/src/simple_authn/emqx_authn_mnesia.erl

@@ -90,7 +90,7 @@ roots() -> [?CONF_NS].
 fields(?CONF_NS) ->
     [ {mechanism, emqx_authn_schema:mechanism('password-based')}
     , {backend, emqx_authn_schema:backend('built-in-database')}
-    , {user_id_type,            fun user_id_type/1}
+    , {user_id_type, fun user_id_type/1}
     , {password_hash_algorithm, fun emqx_authn_password_hashing:type_rw/1}
     ] ++ emqx_authn_schema:common_fields().
 

+ 5 - 5
apps/emqx_authn/src/simple_authn/emqx_authn_mongodb.erl

@@ -58,11 +58,11 @@ fields('sharded-cluster') ->
 common_fields() ->
     [ {mechanism, emqx_authn_schema:mechanism('password-based')}
     , {backend, emqx_authn_schema:backend(mongodb)}
-    , {collection,              fun collection/1}
-    , {selector,                fun selector/1}
-    , {password_hash_field,     fun password_hash_field/1}
-    , {salt_field,              fun salt_field/1}
-    , {is_superuser_field,      fun is_superuser_field/1}
+    , {collection, fun collection/1}
+    , {selector, fun selector/1}
+    , {password_hash_field, fun password_hash_field/1}
+    , {salt_field, fun salt_field/1}
+    , {is_superuser_field, fun is_superuser_field/1}
     , {password_hash_algorithm, fun emqx_authn_password_hashing:type_ro/1}
     ] ++ emqx_authn_schema:common_fields().
 

+ 2 - 2
apps/emqx_authn/src/simple_authn/emqx_authn_mysql.erl

@@ -47,8 +47,8 @@ fields(?CONF_NS) ->
     [ {mechanism, emqx_authn_schema:mechanism('password-based')}
     , {backend, emqx_authn_schema:backend(mysql)}
     , {password_hash_algorithm, fun emqx_authn_password_hashing:type_ro/1}
-    , {query,                   fun query/1}
-    , {query_timeout,           fun query_timeout/1}
+    , {query, fun query/1}
+    , {query_timeout, fun query_timeout/1}
     ] ++ emqx_authn_schema:common_fields()
     ++ emqx_connector_schema_lib:relational_db_fields()
     ++ emqx_connector_schema_lib:ssl_fields().

+ 1 - 1
apps/emqx_authn/src/simple_authn/emqx_authn_pgsql.erl

@@ -53,7 +53,7 @@ fields(?CONF_NS) ->
     [ {mechanism, emqx_authn_schema:mechanism('password-based')}
     , {backend, emqx_authn_schema:backend(postgresql)}
     , {password_hash_algorithm, fun emqx_authn_password_hashing:type_ro/1}
-    , {query,                   fun query/1}
+    , {query, fun query/1}
     ] ++ emqx_authn_schema:common_fields()
     ++ emqx_connector_schema_lib:relational_db_fields()
     ++ emqx_connector_schema_lib:ssl_fields().

+ 1 - 1
apps/emqx_authn/src/simple_authn/emqx_authn_redis.erl

@@ -58,7 +58,7 @@ fields(sentinel) ->
 common_fields() ->
     [ {mechanism, emqx_authn_schema:mechanism('password-based')}
     , {backend, emqx_authn_schema:backend(redis)}
-    , {cmd,                     fun cmd/1}
+    , {cmd, fun cmd/1}
     , {password_hash_algorithm, fun emqx_authn_password_hashing:type_ro/1}
     ] ++ emqx_authn_schema:common_fields().
 

+ 28 - 16
apps/emqx_authz/src/emqx_authz_api_mnesia.erl

@@ -222,24 +222,36 @@ schema("/authorization/sources/built-in-database/purge-all") ->
     }.
 
 fields(rule_item) ->
-    [ {topic,      hoconsc:mk( string()
-                             , #{ required => true
-                                , desc => <<"Rule on specific topic">>
-                                , example => <<"test/topic/1">>})}
-    , {permission, hoconsc:mk( hoconsc:enum([allow, deny])
-                             , #{desc => <<"Permission">>, required => true, example => allow})}
-    , {action,     hoconsc:mk( hoconsc:enum([publish, subscribe, all])
-                             , #{ required => true, example => publish
-                                , desc => <<"Authorized action">> })} ];
+    [ {topic, hoconsc:mk(string(),
+        #{ required => true
+         , desc => <<"Rule on specific topic">>
+         , example => <<"test/topic/1">>
+         })}
+    , {permission, hoconsc:mk(hoconsc:enum([allow, deny]),
+        #{ desc => <<"Permission">>
+         , required => true
+         , example => allow
+         })}
+    , {action, hoconsc:mk(hoconsc:enum([publish, subscribe, all]),
+        #{ required => true
+         , example => publish
+         , desc => <<"Authorized action">>
+         })}
+    ];
 fields(clientid) ->
-    [ {clientid, hoconsc:mk( binary()
-                           , #{ in => path, required => true
-                              , desc => <<"ClientID">>, example => <<"client1">>})}
+    [ {clientid, hoconsc:mk(binary(),
+        #{ in => path
+         , required => true
+         , desc => <<"ClientID">>
+         , example => <<"client1">>
+         })}
     ];
 fields(username) ->
-    [ {username, hoconsc:mk( binary()
-                           , #{ in => path, required => true
-                              , desc => <<"Username">>, example => <<"user1">>})}
+    [ {username, hoconsc:mk(binary(),
+        #{ in => path
+         , required => true
+         , desc => <<"Username">>
+         , example => <<"user1">>})}
     ];
 fields(rules_for_username) ->
     [ {rules, hoconsc:mk(hoconsc:array(hoconsc:ref(rule_item)), #{})}
@@ -400,7 +412,7 @@ rules_example({ExampleName, ExampleType}) ->
         case ExampleName of
             username -> {<<"Username">>, ?USERNAME_RULES_EXAMPLE};
             clientid -> {<<"ClientID">>, ?CLIENTID_RULES_EXAMPLE};
-            all      -> {<<"All">>,      ?ALL_RULES_EXAMPLE}
+            all      -> {<<"All">>, ?ALL_RULES_EXAMPLE}
         end,
     Value =
         case ExampleType of

+ 1 - 1
apps/emqx_authz/src/emqx_authz_rule.erl

@@ -31,7 +31,7 @@
         , compile/1
         ]).
 
--type(ipaddress() :: {ipaddr,  esockd_cidr:cidr_string()} |
+-type(ipaddress() :: {ipaddr, esockd_cidr:cidr_string()} |
                      {ipaddrs, list(esockd_cidr:cidr_string())}).
 
 -type(username() :: {username, binary()}).

+ 7 - 7
apps/emqx_authz/src/emqx_authz_schema.erl

@@ -106,15 +106,15 @@ and the new rules will override all rules from the old config file.
               }}
     ];
 fields(http_get) ->
-    [ {method,  #{type => get, default => post}}
+    [ {method, #{type => get, default => post}}
     , {headers, fun headers_no_content_type/1}
     ] ++ http_common_fields();
 fields(http_post) ->
-    [ {method,  #{type => post, default => post}}
+    [ {method, #{type => post, default => post}}
     , {headers, fun headers/1}
     ] ++ http_common_fields();
 fields(mnesia) ->
-    [ {type,   #{type => 'built-in-database'}}
+    [ {type, #{type => 'built-in-database'}}
     , {enable, #{type => boolean(),
                  default => true}}
     ];
@@ -144,11 +144,11 @@ fields(redis_cluster) ->
     [ {cmd, query()} ].
 
 http_common_fields() ->
-    [ {type,            #{type => http}}
-    , {enable,          #{type => boolean(), default => true}}
-    , {url,             fun url/1}
+    [ {type, #{type => http}}
+    , {enable, #{type => boolean(), default => true}}
+    , {url, fun url/1}
     , {request_timeout, mk_duration("request timeout", #{default => "30s"})}
-    , {body,            #{type => map(), nullable => true}}
+    , {body, #{type => map(), nullable => true}}
     ] ++ proplists:delete(base_url, emqx_connector_http:fields(config)).
 
 mongo_common_fields() ->

+ 0 - 11
apps/emqx_authz/src/emqx_authz_sup.erl

@@ -32,20 +32,9 @@
 start_link() ->
     supervisor:start_link({local, ?SERVER}, ?MODULE, []).
 
-%% sup_flags() = #{strategy => strategy(),         % optional
-%%                 intensity => non_neg_integer(), % optional
-%%                 period => pos_integer()}        % optional
-%% child_spec() = #{id => child_id(),       % mandatory
-%%                  start => mfargs(),      % mandatory
-%%                  restart => restart(),   % optional
-%%                  shutdown => shutdown(), % optional
-%%                  type => worker(),       % optional
-%%                  modules => modules()}   % optional
 init([]) ->
     SupFlags = #{strategy => one_for_all,
                  intensity => 0,
                  period => 1},
     ChildSpecs = [],
     {ok, {SupFlags, ChildSpecs}}.
-
-%% internal functions

+ 2 - 2
apps/emqx_auto_subscribe/src/emqx_auto_subscribe_schema.erl

@@ -36,10 +36,10 @@ fields("topic") ->
     [ {topic, sc(binary(), #{})}
     , {qos, sc(hoconsc:union([typerefl:integer(0), typerefl:integer(1), typerefl:integer(2)]),
         #{default => 0})}
-    , {rh,  sc(hoconsc:union([typerefl:integer(0), typerefl:integer(1), typerefl:integer(2)]),
+    , {rh, sc(hoconsc:union([typerefl:integer(0), typerefl:integer(1), typerefl:integer(2)]),
         #{default => 0})}
     , {rap, sc(hoconsc:union([typerefl:integer(0), typerefl:integer(1)]), #{default => 0})}
-    , {nl,  sc(hoconsc:union([typerefl:integer(0), typerefl:integer(1)]), #{default => 0})}
+    , {nl, sc(hoconsc:union([typerefl:integer(0), typerefl:integer(1)]), #{default => 0})}
     ].
 
 %%--------------------------------------------------------------------

+ 2 - 2
apps/emqx_conf/src/emqx_conf_cli.erl

@@ -33,7 +33,7 @@ admins(["status"]) -> status();
 admins(["skip"]) ->
     status(),
     Nodes = mria_mnesia:running_nodes(),
-    lists:foreach(fun emqx_cluster_rpc:skip_failed_commit/1,  Nodes),
+    lists:foreach(fun emqx_cluster_rpc:skip_failed_commit/1, Nodes),
     status();
 
 admins(["skip", Node0]) ->
@@ -70,7 +70,7 @@ admins(["fast_forward", Node0, ToTnxId]) ->
 admins(_) ->
     emqx_ctl:usage(
       [
-          {"cluster_call status",  "status"},
+          {"cluster_call status", "status"},
           {"cluster_call skip [node]", "increase one commit on specific node"},
           {"cluster_call tnxid <TnxId>", "get detailed about TnxId"},
           {"cluster_call  fast_forward [node] [tnx_id]", "fast forwards to tnx_id" }

+ 6 - 6
apps/emqx_conf/src/emqx_conf_schema.erl

@@ -263,8 +263,8 @@ fields("node") ->
            })}
     , {"global_gc_interval",
        sc(emqx_schema:duration(),
-         #{  mapping => "emqx_machine.global_gc_interval"
-          ,  default => "15m"
+         #{ mapping => "emqx_machine.global_gc_interval"
+          , default => "15m"
           })}
     , {"crash_dump_file",
        sc(file(),
@@ -386,15 +386,15 @@ fields("cluster_call") ->
           })}
     , {"max_history",
        sc(range(1, 500),
-          #{  desc => "Retain the maximum number of completed transactions (for queries)."
-           ,  default => 100
+          #{ desc => "Retain the maximum number of completed transactions (for queries)."
+           , default => 100
            })}
     , {"cleanup_interval",
        sc(emqx_schema:duration(),
-          #{  desc =>
+          #{ desc =>
 "Time interval to clear completed but stale transactions.
 Ensure that the number of completed transactions is less than the max_history."
-           ,  default => "5m"
+           , default => "5m"
            })}
     ];
 

+ 1 - 1
apps/emqx_gateway/src/coap/emqx_coap_impl.erl

@@ -63,7 +63,7 @@ on_gateway_load(_Gateway = #{name := GwName,
     case start_listeners(
            Listeners, GwName, Ctx, ModCfg) of
         {ok, ListenerPids} ->
-            {ok, ListenerPids,  #{ctx => Ctx}};
+            {ok, ListenerPids, #{ctx => Ctx}};
         {error, {Reason, Listener}} ->
             throw({badconf, #{ key => listeners
                              , vallue => Listener

+ 1 - 1
apps/emqx_gateway/src/emqx_gateway_api_clients.erl

@@ -639,7 +639,7 @@ fields(subscription) ->
        mk(integer(),
           #{ desc => <<"QoS level, enum: 0, 1, 2">>})}
     , {nl,
-       mk(integer(),     %% FIXME: why not boolean?
+       mk(integer(), %% FIXME: why not boolean?
           #{ desc => <<"No Local option, enum: 0, 1">>})}
     , {rap,
        mk(integer(),

+ 1 - 1
apps/emqx_gateway/src/lwm2m/emqx_lwm2m_session.erl

@@ -87,7 +87,7 @@
 -define(RECORD_SIZE(R), (erlang:map_size(R) - 1)).
 
 %% uplink and downlink topic configuration
--define(lwm2m_up_dm_topic,  {<<"/v1/up/dm">>, 0}).
+-define(lwm2m_up_dm_topic, {<<"/v1/up/dm">>, 0}).
 
 %% steal from emqx_session
 -define(INFO_KEYS, [id,

+ 1 - 1
apps/emqx_machine/src/emqx_machine_boot.erl

@@ -44,7 +44,7 @@ print_vsn() ->
 
 
 start_autocluster() ->
-    ekka:callback(stop,  fun emqx_machine_boot:stop_apps/0),
+    ekka:callback(stop, fun emqx_machine_boot:stop_apps/0),
     ekka:callback(start, fun emqx_machine_boot:ensure_apps_started/0),
     _ = ekka:autocluster(emqx), %% returns 'ok' or a pid or 'any()' as in spec
     ok.

+ 4 - 4
apps/emqx_modules/src/emqx_rewrite.erl

@@ -48,9 +48,9 @@ enable() ->
     register_hook(Rules).
 
 disable() ->
-    emqx_hooks:del('client.subscribe',   {?MODULE, rewrite_subscribe}),
+    emqx_hooks:del('client.subscribe', {?MODULE, rewrite_subscribe}),
     emqx_hooks:del('client.unsubscribe', {?MODULE, rewrite_unsubscribe}),
-    emqx_hooks:del('message.publish',    {?MODULE, rewrite_publish}),
+    emqx_hooks:del('message.publish', {?MODULE, rewrite_publish}),
     ok.
 
 list() ->
@@ -63,9 +63,9 @@ update(Rules0) ->
 register_hook([]) -> disable();
 register_hook(Rules) ->
     {PubRules, SubRules, ErrRules} = compile(Rules),
-    emqx_hooks:put('client.subscribe',   {?MODULE, rewrite_subscribe, [SubRules]}),
+    emqx_hooks:put('client.subscribe', {?MODULE, rewrite_subscribe, [SubRules]}),
     emqx_hooks:put('client.unsubscribe', {?MODULE, rewrite_unsubscribe, [SubRules]}),
-    emqx_hooks:put('message.publish',    {?MODULE, rewrite_publish, [PubRules]}),
+    emqx_hooks:put('message.publish', {?MODULE, rewrite_publish, [PubRules]}),
     case ErrRules of
         [] -> ok;
         _ ->

+ 4 - 4
apps/emqx_modules/src/emqx_topic_metrics.erl

@@ -101,13 +101,13 @@ max_limit() ->
     ?MAX_TOPICS.
 
 enable() ->
-    emqx_hooks:put('message.publish',   {?MODULE, on_message_publish, []}),
-    emqx_hooks:put('message.dropped',   {?MODULE, on_message_dropped, []}),
+    emqx_hooks:put('message.publish', {?MODULE, on_message_publish, []}),
+    emqx_hooks:put('message.dropped', {?MODULE, on_message_dropped, []}),
     emqx_hooks:put('message.delivered', {?MODULE, on_message_delivered, []}).
 
 disable() ->
-    emqx_hooks:del('message.publish',   {?MODULE, on_message_publish}),
-    emqx_hooks:del('message.dropped',   {?MODULE, on_message_dropped}),
+    emqx_hooks:del('message.publish', {?MODULE, on_message_publish}),
+    emqx_hooks:del('message.dropped', {?MODULE, on_message_dropped}),
     emqx_hooks:del('message.delivered', {?MODULE, on_message_delivered}),
     deregister_all().
 

+ 9 - 9
apps/emqx_modules/src/emqx_topic_metrics_api.erl

@@ -150,55 +150,55 @@ fields(metrics) ->
       , mk( integer(), #{ desc => <<"Message dropped count">>
                         , example => 0})},
       { 'messages.dropped.rate'
-      , mk( number(),  #{ desc => <<"Message dropped rate in 5s">>
+      , mk( number(), #{ desc => <<"Message dropped rate in 5s">>
                         , example => 0})},
       { 'messages.in.count'
       , mk( integer(), #{ desc => <<"Message received count">>
                         , example => 0})},
       { 'messages.in.rate'
-      , mk( number(),  #{ desc => <<"Message received rate in 5s">>
+      , mk( number(), #{ desc => <<"Message received rate in 5s">>
                         , example => 0})},
       { 'messages.out.count'
       , mk( integer(), #{ desc => <<"Message sent count">>
                         , example => 0})},
       { 'messages.out.rate'
-      , mk( number(),  #{ desc => <<"Message sent rate in 5s">>
+      , mk( number(), #{ desc => <<"Message sent rate in 5s">>
                         , example => 0})},
       { 'messages.qos0.in.count'
       , mk( integer(), #{ desc => <<"Message with QoS 0 received count">>
                         , example => 0})},
       { 'messages.qos0.in.rate'
-      , mk( number(),  #{ desc => <<"Message with QoS 0 received rate in 5s">>
+      , mk( number(), #{ desc => <<"Message with QoS 0 received rate in 5s">>
                         , example => 0})},
       { 'messages.qos0.out.count'
       , mk( integer(), #{ desc => <<"Message with QoS 0 sent count">>
                         , example => 0})},
       { 'messages.qos0.out.rate'
-      , mk( number(),  #{ desc => <<"Message with QoS 0 sent rate in 5s">>
+      , mk( number(), #{ desc => <<"Message with QoS 0 sent rate in 5s">>
                         , example => 0})},
       { 'messages.qos1.in.count'
       , mk( integer(), #{ desc => <<"Message with QoS 1 received count">>
                         , example => 0})},
       { 'messages.qos1.in.rate'
-      , mk( number(),  #{ desc => <<"Message with QoS 1 received rate in 5s">>
+      , mk( number(), #{ desc => <<"Message with QoS 1 received rate in 5s">>
                         , example => 0})},
       { 'messages.qos1.out.count'
       , mk( integer(), #{ desc => <<"Message with QoS 1 sent count">>
                         , example => 0})},
       { 'messages.qos1.out.rate'
-      , mk( number(),  #{ desc => <<"Message with QoS 1 sent rate in 5s">>
+      , mk( number(), #{ desc => <<"Message with QoS 1 sent rate in 5s">>
                         , example => 0})},
       { 'messages.qos2.in.count'
       , mk( integer(), #{ desc => <<"Message with QoS 2 sent count">>
                         , example => 0})},
       { 'messages.qos2.in.rate'
-      , mk( number(),  #{ desc => <<"Message with QoS 2 received rate in 5s">>
+      , mk( number(), #{ desc => <<"Message with QoS 2 received rate in 5s">>
                         , example => 0})},
       { 'messages.qos2.out.count'
       , mk( integer(), #{ desc => <<"Message with QoS 2 sent count">>
                         , example => 0})},
       { 'messages.qos2.out.rate'
-      , mk( number(),  #{ desc => <<"Message with QoS 2 sent rate in 5s">>
+      , mk( number(), #{ desc => <<"Message with QoS 2 sent rate in 5s">>
                         , example => 0})}
     ].
 

+ 1 - 1
apps/emqx_prometheus/src/emqx_prometheus.erl

@@ -202,7 +202,7 @@ collect_metrics(Name, Metrics) ->
     emqx_collect(Name, Metrics).
 
 add_collect_family(Name, Data, Callback, Type) ->
-    Callback(create_schema(Name, <<"">>,  Data, Type)).
+    Callback(create_schema(Name, <<"">>, Data, Type)).
 
 create_schema(Name, Help, Data, Type) ->
   create_mf(Name, Help, Type, ?MODULE, Data).

+ 3 - 3
apps/emqx_psk/src/emqx_psk_schema.erl

@@ -42,9 +42,9 @@ to which is configurable by the <code>init_file</code> field.
      }.
 
 fields() ->
-    [ {enable,     fun enable/1}
-    , {init_file,  fun init_file/1}
-    , {separator,  fun separator/1}
+    [ {enable, fun enable/1}
+    , {init_file, fun init_file/1}
+    , {separator, fun separator/1}
     , {chunk_size, fun chunk_size/1}
     ].
 

+ 1 - 1
apps/emqx_retainer/src/emqx_retainer_api.erl

@@ -131,7 +131,7 @@ config(get, _) ->
 config(put, #{body := Body}) ->
     try
         {ok, _} = emqx_retainer:update_config(Body),
-        {200,  emqx:get_raw_config([retainer])}
+        {200, emqx:get_raw_config([retainer])}
     catch _:Reason:_ ->
             {400,
              #{code => 'UPDATE_FAILED',

+ 1 - 1
apps/emqx_statsd/src/emqx_statsd_schema.erl

@@ -36,7 +36,7 @@ fields("statsd") ->
     [ {enable, hoconsc:mk(boolean(), #{default => false, nullable => false})}
     , {server, fun server/1}
     , {sample_time_interval, fun duration_ms/1}
-    , {flush_time_interval,  fun duration_ms/1}
+    , {flush_time_interval, fun duration_ms/1}
     ].
 
 server(type) -> emqx_schema:ip_port();

+ 2 - 2
deploy/docker/README.md

@@ -10,7 +10,7 @@
 
 + **Supported architectures**
 
-  `amd64`, `arm64v8`,  `arm32v7`, `i386`, `s390x`
+  `amd64`, `arm64v8`, `arm32v7`, `i386`, `s390x`
 
 
 + **Supported Docker versions**:
@@ -21,7 +21,7 @@
 
 [EMQ X  MQTT broker](https://emqx.io/products/broker) is a fully open source, highly scalable, highly available distributed MQTT messaging broker for IoT, M2M and Mobile applications that can handle tens of millions of concurrent clients.
 
-Starting from 3.0 release, *EMQ X* broker fully supports MQTT V5.0 protocol specifications and backward compatible with MQTT V3.1 and V3.1.1,  as well as other communication protocols such as MQTT-SN, CoAP, LwM2M, WebSocket and STOMP. The 3.0 release of the *EMQ X* broker can scaled to 10+ million concurrent MQTT connections on one cluster.
+Starting from 3.0 release, *EMQ X* broker fully supports MQTT V5.0 protocol specifications and backward compatible with MQTT V3.1 and V3.1.1, as well as other communication protocols such as MQTT-SN, CoAP, LwM2M, WebSocket and STOMP. The 3.0 release of the *EMQ X* broker can scaled to 10+ million concurrent MQTT connections on one cluster.
 
 # How to use this image