Explorar el Código

chore(style): fix elvis check for emqx_connection

Zaiming Shi hace 5 años
padre
commit
406a7d60c7
Se han modificado 2 ficheros con 7 adiciones y 5 borrados
  1. 6 4
      src/emqx_connection.erl
  2. 1 1
      src/emqx_os_mon.erl

+ 6 - 4
src/emqx_connection.erl

@@ -29,6 +29,8 @@
 -compile(nowarn_export_all).
 -compile(nowarn_export_all).
 -endif.
 -endif.
 
 
+-elvis([{elvis_style, invalid_dynamic_call, #{ ignore => [emqx_connection]}}]).
+
 %% API
 %% API
 -export([ start_link/3
 -export([ start_link/3
         , stop/1
         , stop/1
@@ -661,7 +663,7 @@ tcp_congestion_alarm_details(Socket, Transport, Channel) ->
 
 
 conn_info(Key, Channel) when Key =:= sockname; Key =:= peername ->
 conn_info(Key, Channel) when Key =:= sockname; Key =:= peername ->
     {IPStr, Port} = emqx_channel:info(Key, Channel),
     {IPStr, Port} = emqx_channel:info(Key, Channel),
-    {Key, iolist_to_binary([inet:ntoa(IPStr),":",integer_to_list(Port)])};
+    {Key, iolist_to_binary([inet:ntoa(IPStr), ":", integer_to_list(Port)])};
 conn_info(Key, Channel) ->
 conn_info(Key, Channel) ->
     {Key, emqx_channel:info(Key, Channel)}.
     {Key, emqx_channel:info(Key, Channel)}.
 
 
@@ -671,9 +673,9 @@ conn_info(Key, Channel) ->
 handle_info(activate_socket, State = #state{sockstate = OldSst}) ->
 handle_info(activate_socket, State = #state{sockstate = OldSst}) ->
     case activate_socket(State) of
     case activate_socket(State) of
         {ok, NState = #state{sockstate = NewSst}} ->
         {ok, NState = #state{sockstate = NewSst}} ->
-            if OldSst =/= NewSst ->
-                   {ok, {event, NewSst}, NState};
-               true -> {ok, NState}
+            case OldSst =/= NewSst of
+                true -> {ok, {event, NewSst}, NState};
+                false -> {ok, NState}
             end;
             end;
         {error, Reason} ->
         {error, Reason} ->
             handle_info({sock_error, Reason}, State)
             handle_info({sock_error, Reason}, State)

+ 1 - 1
src/emqx_os_mon.erl

@@ -81,7 +81,7 @@ get_mem_check_interval() ->
 
 
 set_mem_check_interval(Seconds) when Seconds < 60 ->
 set_mem_check_interval(Seconds) when Seconds < 60 ->
     memsup:set_check_interval(1);
     memsup:set_check_interval(1);
-set_mem_check_interval(Seconds) -> 
+set_mem_check_interval(Seconds) ->
     memsup:set_check_interval(Seconds div 60).
     memsup:set_check_interval(Seconds div 60).
 
 
 get_sysmem_high_watermark() ->
 get_sysmem_high_watermark() ->