fix: elvis warning

This commit is contained in:
Zhongwen Deng 2022-03-08 14:50:10 +08:00
parent ef5fcd388b
commit 512a5c3b8e
2 changed files with 7 additions and 6 deletions

View File

@ -22,8 +22,6 @@
-include_lib("emqx/include/emqx.hrl"). -include_lib("emqx/include/emqx.hrl").
-include_lib("eunit/include/eunit.hrl"). -include_lib("eunit/include/eunit.hrl").
-define(TRIE, emqx_trie).
all() -> all() ->
[{group, compact}, [{group, compact},
{group, not_compact} {group, not_compact}

View File

@ -35,7 +35,7 @@ paths() ->
schema("/mqtt/topic_rewrite") -> schema("/mqtt/topic_rewrite") ->
#{ #{
operationId => topic_rewrite, 'operationId' => topic_rewrite,
get => #{ get => #{
tags => ?API_TAG_MQTT, tags => ?API_TAG_MQTT,
description => <<"List rewrite topic.">>, description => <<"List rewrite topic.">>,
@ -47,11 +47,13 @@ schema("/mqtt/topic_rewrite") ->
put => #{ put => #{
description => <<"Update rewrite topic">>, description => <<"Update rewrite topic">>,
tags => ?API_TAG_MQTT, tags => ?API_TAG_MQTT,
requestBody => hoconsc:mk(hoconsc:array(hoconsc:ref(emqx_modules_schema, "rewrite")),#{}), 'requestBody' => hoconsc:mk(hoconsc:array(
hoconsc:ref(emqx_modules_schema, "rewrite")),#{}),
responses => #{ responses => #{
200 => hoconsc:mk(hoconsc:array(hoconsc:ref(emqx_modules_schema, "rewrite")), 200 => hoconsc:mk(hoconsc:array(hoconsc:ref(emqx_modules_schema, "rewrite")),
#{desc => <<"Update rewrite topic success.">>}), #{desc => <<"Update rewrite topic success.">>}),
413 => emqx_dashboard_swagger:error_codes([?EXCEED_LIMIT], <<"Rules count exceed max limit">>) 413 => emqx_dashboard_swagger:error_codes([?EXCEED_LIMIT],
<<"Rules count exceed max limit">>)
} }
} }
}. }.
@ -65,6 +67,7 @@ topic_rewrite(put, #{body := Body}) ->
ok = emqx_rewrite:update(Body), ok = emqx_rewrite:update(Body),
{200, emqx_rewrite:list()}; {200, emqx_rewrite:list()};
_ -> _ ->
Message = iolist_to_binary(io_lib:format("Max rewrite rules count is ~p", [?MAX_RULES_LIMIT])), Message = iolist_to_binary(
io_lib:format("Max rewrite rules count is ~p", [?MAX_RULES_LIMIT])),
{413, #{code => ?EXCEED_LIMIT, message => Message}} {413, #{code => ?EXCEED_LIMIT, message => Message}}
end. end.