Explorar o código

style(elvis): force spaces around | and ||

Zaiming Shi %!s(int64=4) %!d(string=hai) anos
pai
achega
5b126d60ad
Modificáronse 2 ficheiros con 9 adicións e 4 borrados
  1. 3 2
      apps/emqx_exhook/src/emqx_exhook_cli.erl
  2. 6 2
      elvis.config

+ 3 - 2
apps/emqx_exhook/src/emqx_exhook_cli.erl

@@ -23,7 +23,8 @@
 cli(["server", "list"]) ->
     if_enabled(fun() ->
         Services = emqx_exhook:list(),
-        [emqx_ctl:print("HookServer(~s)~n", [emqx_exhook_server:format(Service)]) || Service <- Services]
+        [emqx_ctl:print("HookServer(~s)~n",
+                        [emqx_exhook_server:format(Service)]) || Service <- Services]
     end);
 
 cli(["server", "enable", Name0]) ->
@@ -74,7 +75,7 @@ hint() ->
 stats() ->
     lists:usort(lists:foldr(fun({K, N}, Acc) ->
         case atom_to_list(K) of
-            "exhook." ++ Key -> [{Key, N}|Acc];
+            "exhook." ++ Key -> [{Key, N} | Acc];
             _ -> Acc
         end
     end, [], emqx_metrics:all())).

+ 6 - 2
elvis.config

@@ -5,7 +5,7 @@
    [
     {config,
      [
-      #{dirs => ["src", "apps/**/src", "lib-ce/**/src"],
+      #{dirs => ["src", "apps/**/src", "lib-ce/**/src", "lib-ee/**/src"],
         filter => "*.erl",
         ruleset => erl_files,
         rules => [
@@ -13,7 +13,11 @@
             {elvis_style, no_common_caveats_call, #{}},
             {elvis_style, no_debug_call, #{ debug_functions => [ {ct, pal}
                                                                , {ct, print}
-                                                               ]}}
+                                                               ]}},
+            {elvis_style, operator_spaces, #{rules => [{right, "|"},
+                                                       {left, "|"},
+                                                       {right, "||"},
+                                                       {left, "||"}]}}
            ]
         },
       #{dirs => ["test", "apps/**/test", "lib-ce/**/src"],