elvis_core
elvis_core copied to clipboard
macro_module_names false-positive
I use macroses to hide internal exception data structure.
I have .hrl file like
-define(MATCH_MY_ERROR, {my_error, _, _}).
-define(MATCH_MY_ERROR(ErrorTag), {my_error, ErrorTag, _}).
And inside my code I use constructions like
-include_lib("my_app/include/error.hrl").
try my_logick()
catch
throw:?MATCH_MY_ERROR(bad_auth) ->
% handle auth error
throw:?MATCH_MY_ERROR(input_validation) ->
% handle validation error
throw:?MATCH_MY_ERROR ->
% handle other application errors
end.
And elvis thinks that I use macros as function name placeholder, but that's not true.
awesome catch, @seriyps !!