Skip to content
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

Document -elvis attribute #535

Closed
paulo-ferraz-oliveira opened this issue Sep 22, 2020 · 2 comments
Closed

Document -elvis attribute #535

paulo-ferraz-oliveira opened this issue Sep 22, 2020 · 2 comments
Labels
documentation Documentation

Comments

@paulo-ferraz-oliveira
Copy link
Collaborator

paulo-ferraz-oliveira commented Sep 22, 2020

Related to inaka/elvis_core#136.

Edit: can be used to update the Rules wiki. Once the related PR is accepted.

Tentative documentation follows.

The -elvis attribute

Per-module rules can also be configured using attribute -elvis(_)., with the same content as is expected in elvis.config's rules option, e.g.:

-elvis([{elvis_style, no_behavior_info, #{}}]).
-elvis([{elvis_style, no_nested_try_catch}]).

Note: a single attribute with a list of rules is the same as multiples attributes with a list of rules each - the rules are "merged" - as in:

-elvis([{elvis_style, no_behavior_info, #{}}, {elvis_style, no_nested_try_catch}]).

The ignore attribute, in this case, has limited value, since it'll be ignored for "other" modules. You can always play with the following, but results may not be surprising.

-module(mymodule).
-elvis([{elvis_style, nesting_level, #{level => 4, ignore => [mymodule]}}]).
...
@elbrujohalcon
Copy link
Member

Haha! The ignore part... I would have forgotten about it entirely. Nice touch.
Looks good.

@paulo-ferraz-oliveira paulo-ferraz-oliveira added the documentation Documentation label Sep 24, 2020
@paulo-ferraz-oliveira
Copy link
Collaborator Author

I've added this to the Rules wiki since it's already available in master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation
Projects
None yet
Development

No branches or pull requests

2 participants