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

Fix #162: New Rule: No Types #270

Merged
merged 1 commit into from
Feb 27, 2023
Merged

Fix #162: New Rule: No Types #270

merged 1 commit into from
Feb 27, 2023

Conversation

elbrujohalcon
Copy link
Member

Fixes #162 by adding a new rule ( {elvis_style, no_types} ) that only applies (by default) to the hrl_files ruleset.

@elbrujohalcon elbrujohalcon added this to the 2.1.0 milestone Feb 27, 2023

Avoid `-type` attributes.

This rule is meant to be used on header files only.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be restricted by code, right? Or does Erlang accept, for header files, anything other than .hrl?

Copy link
Member Author

@elbrujohalcon elbrujohalcon Feb 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Erlang accepts anything. You can 100% write this and it will work…

-include("LICENSE.txt").
-module my_mod.

…

Why on Earth will you want to do that is a mystery to me, but it's 100% valid.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant when we're listing the files for analysis we can restrict certain rules to certain file types (not sure if desired).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rule is meant to be used on header files only.

But wait, our analysis already is scoped, right? If you use a rebar.config rule on an .erl file it shouldn't work, should it? Not sure I've tried it or we test it, but pretty sure there's some restrictions in place.

Copy link
Collaborator

@paulo-ferraz-oliveira paulo-ferraz-oliveira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good.

@elbrujohalcon elbrujohalcon merged commit 1f3aa60 into main Feb 27, 2023
@elbrujohalcon elbrujohalcon deleted the brujo.162.no_types branch February 27, 2023 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rule idea: no -types in .hrl files
2 participants