-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
variable_naming_convention and MACROs #362
variable_naming_convention and MACROs #362
Conversation
This only appears to be an issue when the macro is the return value of something (e.g. hello(Who) ->
who(Who).
who(undefined) ->
undefined;
who(_) ->
?MODULE_STRING. The above snippet will cause
|
And I apologize, I was wrong in my above assertion, but I'm leaving it there so you know that it's not return values. The following will error on the 1-arity function, but not the 0-arity: test() ->
?MODULE_STRING.
test_two(_) ->
?MODULE_STRING. |
@andreineculau @eric-dunham I run What versions of Erlang/OTP and elvis are you guys using? |
Now I see it!! I changed the regex to |
Turns out |
Thanks! For reference, I'm running Elvis 0.2.11 and Erlang/OTP 18.3:
|
And since I can't drag and drop a .config file, here's my elvis.config, for reference: [
{
elvis,
[
{config,
[#{dirs => ["src", "test"],
filter => "*.erl",
rules => [
{elvis_style, dont_repeat_yourself},
{elvis_style, function_naming_convention, #{regex => "^([a-z]*_?)*(_SUITE)?$"}},
{elvis_style, god_modules, #{limit => 25}},
{elvis_style, invalid_dynamic_calls},
{elvis_style, line_length, #{limit => 120}},
{elvis_style, macro_module_names, #{}},
{elvis_style, macro_names, #{}},
{elvis_style, max_function_length, #{max_length => 50, count_comments => false, count_whitespace => false}},
{elvis_style, max_module_length, #{max_length => 1000, count_comments => false, count_whitespace => false}},
{elvis_style, module_naming_convention, #{regex => "^([a-z][a-z0-9]*_?)*(_SUITE)?$"}},
{elvis_style, nesting_level, #{level => 3}},
{elvis_style, no_behavior_info, #{}},
{elvis_style, no_debug_call},
{elvis_style, no_if_expression, #{}},
{elvis_style, no_nested_try_catch, #{}},
{elvis_style, no_spec_with_records, #{}},
{elvis_style, no_tabs, #{}},
{elvis_style, no_trailing_whitespace, #{ignore_empty_lines => true}},
{elvis_style, operator_spaces, #{rules => [{right, ","}, {right, "++"}, {left, "++"}]}},
{elvis_style, state_record_and_type, #{}},
{elvis_style, used_ignored_variable, #{}},
{elvis_style, variable_naming_convention, #{regex => "^([A-Z][0-9a-zA-Z]*)$"}}
],
ruleset => erl_files
},
#{dirs => ["."],
filter => "Makefile",
ruleset => makefiles
},
#{dirs => ["."],
filter => "rebar.config",
ruleset => rebar_config
},
#{dirs => ["."],
filter => "elvis.config",
ruleset => elvis_config
}
]
}
]
}
]. |
* [#362] [inaka/elvis#362] Adding variable naming convention to erl_files ruleset * [#362] [inaka/elvis#362] Add test * [#362] Remove comments that showed up when tests passed * [#362] [Fix inaka/elvis#362] Correctly distinguish macros from variables * [#362] Fix mixed style issue
the
variable_naming_convention
rule complains incorrectly about MACRO names