refactor: make elvis happy
This commit is contained in:
parent
bf12efac6d
commit
41677eb785
|
@ -160,8 +160,7 @@ assert_func_exported(emqx_variform_str, concat, _Arity) ->
|
|||
assert_func_exported(emqx_variform_str, coalesce, _Arity) ->
|
||||
ok;
|
||||
assert_func_exported(Mod, Fun, Arity) ->
|
||||
%% ensure beam loaded
|
||||
_ = Mod:module_info(md5),
|
||||
ok = try_load(Mod),
|
||||
case erlang:function_exported(Mod, Fun, Arity) of
|
||||
true ->
|
||||
ok;
|
||||
|
@ -174,6 +173,18 @@ assert_func_exported(Mod, Fun, Arity) ->
|
|||
})
|
||||
end.
|
||||
|
||||
%% best effort to load the module because it might not be loaded as a part of the release modules
|
||||
%% e.g. from a plugin.
|
||||
%% do not call code server, just try to call a function in the module.
|
||||
try_load(Mod) ->
|
||||
try
|
||||
_ = erlang:apply(Mod, module_info, [md5]),
|
||||
ok
|
||||
catch
|
||||
_:_ ->
|
||||
ok
|
||||
end.
|
||||
|
||||
assert_module_allowed(emqx_variform_str) ->
|
||||
ok;
|
||||
assert_module_allowed(Mod) ->
|
||||
|
|
Loading…
Reference in New Issue