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/Aleppo can't handle a comment on first line of a module #93

Closed
erszcz opened this issue Sep 5, 2014 · 4 comments
Closed

Elvis/Aleppo can't handle a comment on first line of a module #93

erszcz opened this issue Sep 5, 2014 · 4 comments
Labels

Comments

@erszcz
Copy link

erszcz commented Sep 5, 2014

It seems so... here's an example:

$ git clone git://github.com/esl/escalus
$ cd escalus
$ make
...
$ cat > elvis.config
[
 {
   elvis,
   [
    {config,
      #{src_dirs => ["src", "test"],
        rules    => [{elvis_style, line_length, [80]},
                     {elvis_style, no_tabs, []},
                     {elvis_style, macro_names, []},
                     {elvis_style, macro_module_names, []},
                     {elvis_style, operator_spaces, [{right, ","}, {right, "++"}, {left, "++"}]},

                     %% max indentation level
                     {elvis_style, nesting_level, [3]},
                     %% max number of exported functions
                     {elvis_style, god_modules, [30]},
                     {elvis_style, no_if_expression, []},
                     {elvis_style, invalid_dynamic_call, []},
                     {elvis_style, used_ignored_variable, []},
                     {elvis_style, no_behavior_info, []},
                     {elvis_style, module_naming_convention, ["escalus_[a-z0-9]+"]}
                    ]
       }
    },
    {github_user, "user"},
    {github_password, "password"}
   ]
 }
].
^D
$ cp ~/work/inaka/elvis/elvis ./
$ ./elvis rock --config elvis.config
escript: exception error: no match of right hand side value
                 {error,{{1,1},
                         aleppo_parser,
                         ["syntax error before: ",
                          "%%%==================================================================="]}}
  in function  elvis_code:parse_tree/2 (src/elvis_code.erl, line 70)
  in call from elvis_utils:parse_tree/2 (src/elvis_utils.erl, line 57)
  in call from elvis_utils:load_file_data/2 (src/elvis_utils.erl, line 69)
  in call from lists:map/2 (lists.erl, line 1237)
  in call from elvis:rock/1 (src/elvis.erl, line 53)
  in call from elvis:process_commands/2 (src/elvis.erl, line 152)
  in call from elvis:process_options/2 (src/elvis.erl, line 131)

Elvis used: 4eb2bf8, Escalus: https://github.com/esl/escalus/tree/af0a385b53da5966fb2d031d8f9e5f121c91af5a

@jfacorro
Copy link
Contributor

jfacorro commented Sep 5, 2014

Hi @Lavrin! When running elvis (4eb2bf8) on the escalus project I get the following error but not the one you are seeing:

Error: {unhandled_abstract_form,
           {ann_type,
               [{line,28},{column,29},{text,"Zin"}],
               [{var,[{line,28},{column,29},{text,"Zin"}],'Zin'},
                {remote_type,
                    [{line,28},{column,34},{text,"zlib"}],
                    [{atom,[{line,28},{column,34},{text,"zlib"}],zlib},
                     {atom,[{line,28},{column,39},{text,"zstream"}],zstream},
                     []]}]}}.

This one is caused by the unhandled ann_type abstract form.

Could you try running elvis on the jfacorro.93.comments.on.first.line branch for the escalus project? After checking that branch out please remember to run make escript so that the elvis executable is generated.

Let me know how it turns out.

Thanks for reporting the issue and using elvis!

@jfacorro
Copy link
Contributor

jfacorro commented Sep 5, 2014

@Lavrin I just thought about something. Maybe the deps/aleppo is out of date since the last time it was modified (although it has been almost a month already). I'm just mentioning this because outdated deps have caused me some troubles and I can't seem to figure out why I'm not seeing the same error with the same elvis version.

elbrujohalcon added a commit that referenced this issue Sep 8, 2014
[#93] Added handling for unhandled and unexpected abstract forms.
@jfacorro
Copy link
Contributor

jfacorro commented Sep 8, 2014

@Lavrin We've just pushed the change on master. Please check if it works for you now and let us know.

Thanks!

@jfacorro jfacorro closed this as completed Sep 8, 2014
@erszcz
Copy link
Author

erszcz commented Sep 8, 2014

Works great now. Thanks!
BTW, the initial problem was probably caused by outdated deps.

@jfacorro jfacorro added the bug label Sep 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants