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

elvis_style:is_otp_module only checks behavior attribute, not behaviour #550

Closed
NAR opened this issue Nov 20, 2020 · 7 comments
Closed

elvis_style:is_otp_module only checks behavior attribute, not behaviour #550

NAR opened this issue Nov 20, 2020 · 7 comments

Comments

@NAR
Copy link

NAR commented Nov 20, 2020

In Erlang both the US and British spelling is accepted for the -behaviour attribute, however, the elvis_style:is_otp_module/1 function only checks for the US spelling and doesn't detect OTP behaviours using the British spelling:

    IsBehaviorAttr = fun(Node) -> behavior == ktn_code:type(Node) end,

Maybe use something like this:

    IsBehaviorAttr = fun(Node) -> behavior == ktn_code:type(Node) orelse behaviour == ktn_code:type(Node) end,
@elbrujohalcon
Copy link
Member

I would've expected ktn_code to return behavior in both cases, tho… 🤔
If you're certain that it doesn't, and you feel like submitting a PR with the proposed change, that would be highly appreciated.

@NAR
Copy link
Author

NAR commented Nov 20, 2020

When I changed the attribute to -behaviour, I didn't get warning - I presume because the code doesn't detect that the module is an OTP behaviour. WIth -behavior I got the warning. I'll try to cook up a PR.

@NAR
Copy link
Author

NAR commented Nov 20, 2020

See inaka/elvis_core#139

@paulo-ferraz-oliveira
Copy link
Collaborator

I think I've touched this subject somewhere, and @jfacorro got involved. Let me do a quick search...

@paulo-ferraz-oliveira
Copy link
Collaborator

Related: #490.

@paulo-ferraz-oliveira
Copy link
Collaborator

I think I've touched this subject somewhere, and @jfacorro got involved. Let me do a quick search...

My issue was not related to this, but it also boiled down to spelling 😄: #522.

@elbrujohalcon
Copy link
Member

Fixed with inaka/elvis_core#139

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

No branches or pull requests

3 participants