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

FUNCTION_NAME macro treated as variable #505

Closed
hauleth opened this issue Jul 23, 2019 · 8 comments
Closed

FUNCTION_NAME macro treated as variable #505

hauleth opened this issue Jul 23, 2019 · 8 comments
Labels

Comments

@hauleth
Copy link

hauleth commented Jul 23, 2019

I am trying to write Mix task for Elvis unfortunately when some macro tries to use other macro twice it do not expand them and it results in treating FUNCTION_NAME as variable instead of macro, which in the end makes variable_naming_convention fails.

@aboroska
Copy link

I had the same issue. (embedded macros) The quick workaround was to add the following style rule to my elvis.config

rules => [
  {elvis_style, variable_naming_convention,
                  #{regex => "^_?([_A-Z][0-9a-zA-Z]*)$|^FUNCTION_NAME$"}}
]

@hauleth
Copy link
Author

hauleth commented Jul 23, 2019

@aboroska this isn't the only macro that would fail. TBH I think that any predefined macro will also fail as FUNCTION_ARITY also fires the error.

@igaray igaray added the bug label Jul 23, 2019
@hauleth
Copy link
Author

hauleth commented Jul 25, 2019

@igaray it is worth mentioning that it happens me only if I run Elvis installed via Mix, when I am using Elvis via Rebar3 then everything works as expected. So maybe issue is with dependency resolution? I will try to investigate further.

@hauleth
Copy link
Author

hauleth commented Oct 29, 2019

Ok, it fails with rebar3 lint as well. I cannot find any solution, only workarounds.

@jfacorro
Copy link
Contributor

There's a new version of elvis_core that should solve this issue and be able to detect macros, regardless of their names and usage.

@hauleth
Copy link
Author

hauleth commented Dec 14, 2019

@jfacorro you mean elvis_core 0.4.3? This release still has that problem, however on master it seems to be resolved.

@jfacorro
Copy link
Contributor

jfacorro commented Dec 14, 2019

@hauleth Yes, sorry. It is the current master, but I was about to cut a new release and then didn't. The next 0.5.0 release will include the fix.

@jfacorro
Copy link
Contributor

@hauleth There is now a new 0.5.0 release for elvis_core. We will shortly bump it in elvis.

@hauleth hauleth closed this as completed Dec 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants