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

chore: format emqx application

Zhongwen Deng 3 лет назад
Родитель
Сommit
d0d356ec12

+ 12 - 7
apps/emqx/src/emqx_tls_lib.erl

@@ -322,7 +322,8 @@ delete_old_file(_New, Old) ->
     case is_generated_file(Old) andalso filelib:is_regular(Old) andalso file:delete(Old) of
         ok ->
             ok;
-        false -> %% the file is not generated by us, or it is already deleted
+        %% the file is not generated by us, or it is already deleted
+        false ->
             ok;
         {error, Reason} ->
             ?SLOG(error, #{msg => "failed_to_delete_ssl_file", file_path => Old, reason => Reason})
@@ -412,16 +413,21 @@ pem_dir(Dir) ->
     filename:join([emqx:mutable_certs_dir(), Dir]).
 
 is_hex_str(HexStr) ->
-    try is_hex_str2(ensure_str(HexStr))
-    catch throw: not_hex -> false
+    try
+        is_hex_str2(ensure_str(HexStr))
+    catch
+        throw:not_hex -> false
     end.
 
 is_hex_str2(HexStr) ->
-    _ = [case S of
+    _ = [
+        case S of
             S when S >= $0, S =< $9 -> S;
             S when S >= $a, S =< $f -> S;
             _ -> throw(not_hex)
-         end || S <- HexStr],
+        end
+     || S <- HexStr
+    ],
     true.
 
 hex_str(Bin) ->
@@ -457,8 +463,7 @@ do_drop_invalid_certs([Key | Keys], SSL) ->
         PemOrPath ->
             case is_pem(PemOrPath) orelse is_valid_pem_file(PemOrPath) of
                 true -> do_drop_invalid_certs(Keys, SSL);
-                {error, _} ->
-                    do_drop_invalid_certs(Keys, maps:without([Key], SSL))
+                {error, _} -> do_drop_invalid_certs(Keys, maps:without([Key], SSL))
             end
     end.
 

+ 5 - 4
apps/emqx/test/emqx_common_test_helpers.erl

@@ -488,8 +488,9 @@ is_tcp_server_available(Host, Port, Timeout) ->
 start_ekka() ->
     try mnesia_hook:module_info() of
         _ -> ekka:start()
-    catch _:_ ->
-        %% Falling back to using Mnesia DB backend.
-        application:set_env(mria, db_backend, mnesia),
-        ekka:start()
+    catch
+        _:_ ->
+            %% Falling back to using Mnesia DB backend.
+            application:set_env(mria, db_backend, mnesia),
+            ekka:start()
     end.

+ 3 - 1
apps/emqx/test/emqx_config_handler_SUITE.erl

@@ -223,7 +223,9 @@ t_callback_crash(_Config) ->
     Opts = #{rawconf_with_defaults => true},
     ok = emqx_config_handler:add_handler(CrashPath, ?MODULE),
     Old = emqx:get_raw_config(CrashPath),
-    ?assertMatch({error, {config_update_crashed, _}}, emqx:update_config(CrashPath, <<"89%">>, Opts)),
+    ?assertMatch(
+        {error, {config_update_crashed, _}}, emqx:update_config(CrashPath, <<"89%">>, Opts)
+    ),
     New = emqx:get_raw_config(CrashPath),
     ?assertEqual(Old, New),
     ok = emqx_config_handler:remove_handler(CrashPath),