-
Notifications
You must be signed in to change notification settings - Fork 57
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
Decrease chance of error and improve maintenance #135
Decrease chance of error and improve maintenance #135
Conversation
We found different defaults in elvis_style and elvis_rulesets, and in those cases the public Wiki won
This isn't yet complete, but if the general direction isn't this one, I'll want to adapt before I move to the other rulesets. |
Anyway, I had a local version that used macros for functions Basically, where you have option(OptionName, RuleConfig, Rule) you'd have ?OPT(OptionName) with -define(OTP(OptionName), (fun () -> maps:get(OptionName, RuleConfig, default(?FUNCTION_NAME, OptionName)) end)) (with the assumption that |
I then added a further change where -define(?DEF(OptionName), OptionName => default(?FUNCTION_NAME, OptionName)).
% so we could build the options maps as:
#{ ?DEF(limit) }, |
Why these (local) changes? I just feel that defining stuff as #{ limit => default(god_modules, limit)
, ignore => default(god_modules, ignore) is more error-prone than (though the advantage is there's no "magic") #{ ?DEF(limit)
, ?DEF(ignore) } and also I'd prefer to reduce stuff like Regex = option(regex, RuleConfig, function_naming_convention),
Ignores = option(ignore, RuleConfig, function_naming_convention), to Regex = ?OPT(regex),
Ignores = ?OPT(ignore), thus removing the need to keep using |
I pushed a preparation commit for those (macro-based) changes should we want them in |
Oh, and please move us to |
Sorry, @paulo-ferraz-oliveira … but we have a rule against macros. |
All defaults in the same place :-)
I didn't want to change it, since it wasn't affecting the scope of my PR. But I'll do it, as per your request. Edit: 317c0d5 |
Hm... I guess it never made it to Edit: also wanted to point out that Edit: 59300dd |
@elbrujohalcon, don't merge just yet; there's stuff missing for Edit: a7f57b8 |
…inciples everywhere From elvis_style to elvis_project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it ready now, @paulo-ferraz-oliveira ?
It is. |
I found different defaults in
elvis_style
andelvis_rulesets
, and in those cases the public Wiki won.[Fix inaka/elvis#525].