Skip to content

Commit

Permalink
Allow for logger macros (?LOG_... and friends) by default
Browse files Browse the repository at this point in the history
  • Loading branch information
kivra-pauoli committed Feb 28, 2024
1 parent 76df6b3 commit c413147
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/elvis_style.erl
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ check_no_macro_calls(Calls) ->
[elvis_result:item()].
no_macros(ElvisConfig, RuleTarget, RuleConfig) ->
TreeRootNode = get_root(ElvisConfig, RuleTarget, RuleConfig),
AllowedMacros = maps:get(allow, RuleConfig, []) ++ eep_predef_macros(),
AllowedMacros = maps:get(allow, RuleConfig, []) ++ eep_predef_macros() ++ logger_macros(),

MacroNodes =
elvis_code:find(fun is_macro_node/1, TreeRootNode, #{traverse => all, mode => node}),
Expand Down Expand Up @@ -493,6 +493,18 @@ eep_predef_macros() ->
'MODULE_STRING',
'OTP_RELEASE'].

logger_macros() ->
% From logger.hrl
['LOG',
'LOG_ALERT',
'LOG_CRITICAL',
'LOG_DEBUG',
'LOG_EMERGENCY',
'LOG_ERROR',
'LOG_INFO',
'LOG_NOTICE',
'LOG_WARNING'].

-type no_space_after_pound_config() :: #{ignore => [ignorable()]}.

-spec no_space_after_pound(elvis_config:config(),
Expand Down

0 comments on commit c413147

Please sign in to comment.