From 5b126d60ad947f220917f1b826c8f08db7fef4df Mon Sep 17 00:00:00 2001 From: Zaiming Shi Date: Mon, 22 Mar 2021 21:05:15 +0100 Subject: [PATCH] style(elvis): force spaces around | and || --- apps/emqx_exhook/src/emqx_exhook_cli.erl | 5 +++-- elvis.config | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/apps/emqx_exhook/src/emqx_exhook_cli.erl b/apps/emqx_exhook/src/emqx_exhook_cli.erl index 8bab9ced5..9fea1f50d 100644 --- a/apps/emqx_exhook/src/emqx_exhook_cli.erl +++ b/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())). diff --git a/elvis.config b/elvis.config index bed4ba2e8..ae47fc8f9 100644 --- a/elvis.config +++ b/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"],