-
Notifications
You must be signed in to change notification settings - Fork 87
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 complains about dynamic function call in behaviour module #467
Comments
I could isolate the issue. This code generates no warnings: -module(x).
%-include("x.hrl").
-callback x() -> _.
x(X) -> X:x(). This code generates warnings: -module(x).
-include("x.hrl").
-callback x() -> _.
x(X) -> X:x(). This code generates no warnings either: -module(x).
-author("x.hrl").
-callback x() -> _.
x(X) -> X:x(). |
Digging deeper, it looks like aleppo is misunderstanding include attributes. 1> MinContent = "-module(x).\n-include(\"x.hrl\").",
{ok, MinTokens, _} = erl_scan:string(MinContent, {1,1}, [text]),
rp({MinTokens, aleppo:process_tokens(MinTokens)}).
{[{'-',[{text,"-"},{location,{1,1}}]},
{atom,[{text,"module"},{location,{1,2}}],module},
{'(',[{text,"("},{location,{1,8}}]},
{atom,[{text,"x"},{location,{1,9}}],x},
{')',[{text,")"},{location,{1,10}}]},
{dot,[{text,".\n"},{location,{1,11}}]},
{'-',[{text,"-"},{location,{2,1}}]},
{atom,[{text,"include"},{location,{2,2}}],include},
{'(',[{text,"("},{location,{2,9}}]},
{string,[{text,"\"x.hrl\""},{location,{2,10}}],"x.hrl"},
{')',[{text,")"},{location,{2,17}}]},
{dot,[{text,"."},{location,{2,18}}]}],
{ok,[{'-',[{location,{1,1}},{text,"-"},{location,{1,1}}]},
{atom,[{location,{1,2}},{text,"module"},{location,{1,2}}],
module},
{'(',[{location,{1,8}},{text,"("},{location,{1,8}}]},
{atom,[{location,{1,9}},{text,"x"},{location,{1,9}}],x},
{')',[{location,{1,10}},{text,")"},{location,{1,10}}]},
{dot,[{location,{1,11}},{text,".\n"},{location,{1,11}}]},
{string,[{location,{2,10}},
{text,"\"x.hrl\""},
{location,{2,10}}],
"x.hrl"},
{eof,0}]}}
ok As you can see… aleppo is interpreting {string,[{location,{2,10}},
{text,"\"x.hrl\""},
{location,{2,10}}],
"x.hrl"}, …as if it was just |
This is related to #468 since, as stated in inaka/aleppo#45, it can be fixed by providing a proper list of include folders to |
@kzemek in the meantime you could use elvis_core@0.3.9 and set proper |
The callback is defined in the module, but Elvis complains about dynamic function call on a line in the same module.
The text was updated successfully, but these errors were encountered: