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

Misuse of options #468

Closed
elbrujohalcon opened this issue Jul 26, 2017 · 1 comment
Closed

Misuse of options #468

elbrujohalcon opened this issue Jul 26, 2017 · 1 comment

Comments

@elbrujohalcon
Copy link
Member

When elvis_file calls ktn_code:parse_tree/2 in resolve_parse_tree/3, it uses a map() (actually it's elvis' configuration) as the first argument in the call:

-spec resolve_parse_tree(map(), string(), binary()) ->
    undefined | ktn_code:tree_node().
resolve_parse_tree(Config, ".erl", Content) ->
    ktn_code:parse_tree(Config, Content);

But, ktn_code:parse_tree/2 expects a [string()] in the first argument of parse_tree/2. What ktn_code expects is actually a list of include folders to pass in the options to aleppo:

-spec parse_tree([string()], string() | binary()) -> tree_node().
parse_tree(IncludeDirs, Source) ->
    SourceStr = to_str(Source),
    ScanOpts = [text, return_comments],
    {ok, Tokens, _} = erl_scan:string(SourceStr, {1, 1}, ScanOpts),
    Options = [{include, IncludeDirs}],
    {ok, NewTokens} = aleppo:process_tokens(Tokens, Options),
@harenson
Copy link
Member

harenson commented Aug 1, 2017

Fixed in inaka/elvis_core#93

@harenson harenson closed this as completed Aug 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants