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

This commit is contained in:
Zaiming Shi 2021-03-22 21:05:15 +01:00 committed by Zaiming (Stone) Shi
parent dc510fb572
commit 5b126d60ad
2 changed files with 9 additions and 4 deletions

View File

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

View File

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