فهرست منبع

fix(emqx_authn_api): fix elvis error

EMQ-YangM 3 سال پیش
والد
کامیت
7165fbc5ca
3فایلهای تغییر یافته به همراه9 افزوده شده و 9 حذف شده
  1. 6 6
      apps/emqx/src/emqx_map_lib.erl
  2. 2 2
      apps/emqx_authn/src/emqx_authn_api.erl
  3. 1 1
      apps/emqx_authn/test/emqx_authn_api_SUITE.erl

+ 6 - 6
apps/emqx/src/emqx_map_lib.erl

@@ -186,13 +186,13 @@ merge_with(Combiner, Map1, Map2) when is_map(Map1),
     case map_size(Map1) > map_size(Map2) of
         true ->
             Iterator = maps:iterator(Map2),
-            merge_with_1(maps:next(Iterator),
+            merge_with_t(maps:next(Iterator),
                          Map1,
                          Map2,
                          Combiner);
         false ->
             Iterator = maps:iterator(Map1),
-            merge_with_1(maps:next(Iterator),
+            merge_with_t(maps:next(Iterator),
                          Map2,
                          Map1,
                          fun(K, V1, V2) -> Combiner(K, V2, V1) end)
@@ -201,15 +201,15 @@ merge_with(Combiner, Map1, Map2) ->
     error_with_info(error_type_merge_intersect(Map1, Map2, Combiner),
                     [Combiner, Map1, Map2]).
 
-merge_with_1({K, V2, Iterator}, Map1, Map2, Combiner) ->
+merge_with_t({K, V2, Iterator}, Map1, Map2, Combiner) ->
     case Map1 of
         #{ K := V1 } ->
             NewMap1 = Map1#{ K := Combiner(K, V1, V2) },
-            merge_with_1(maps:next(Iterator), NewMap1, Map2, Combiner);
+            merge_with_t(maps:next(Iterator), NewMap1, Map2, Combiner);
         #{ } ->
-            merge_with_1(maps:next(Iterator), maps:put(K, V2, Map1), Map2, Combiner)
+            merge_with_t(maps:next(Iterator), maps:put(K, V2, Map1), Map2, Combiner)
     end;
-merge_with_1(none, Result, _, _) ->
+merge_with_t(none, Result, _, _) ->
     Result.
 
 error_type_merge_intersect(M1, M2, Combiner) when is_function(Combiner, 3) ->

+ 2 - 2
apps/emqx_authn/src/emqx_authn_api.erl

@@ -756,9 +756,9 @@ list_authenticator(ChainName, ConfKeyPath, AuthenticatorID) ->
     AuthenticatorsConfig = get_raw_config_with_defaults(ConfKeyPath),
     case find_config(AuthenticatorID, AuthenticatorsConfig) of
         {ok, AuthenticatorConfig} ->
-            Status_And_Metrics = lookup_from_all_nodes(ChainName, AuthenticatorID),
+            StatusAndMetrics = lookup_from_all_nodes(ChainName, AuthenticatorID),
             Fun = fun ({Key, Val}, Map) -> maps:put(Key, Val, Map) end,
-            AppendList = [{id, AuthenticatorID}, {status_and_metrics, Status_And_Metrics}],
+            AppendList = [{id, AuthenticatorID}, {status_and_metrics, StatusAndMetrics}],
             {200, lists:foldl(Fun, convert_certs(AuthenticatorConfig), AppendList)};
         {error, Reason} ->
             serialize_error(Reason)

+ 1 - 1
apps/emqx_authn/test/emqx_authn_api_SUITE.erl

@@ -178,7 +178,7 @@ test_authenticator(PathPrefix) ->
                 end
             end
         end,
-    LookFun = fun (List) -> (LookupVal(LookupVal)) (List, RList) end,
+    LookFun = fun (List) -> (LookupVal(LookupVal))(List, RList) end,
     MetricsList = [{<<"failed">>, 0},
                    {<<"matched">>, 0},
                    {<<"rate">>, 0.0},