Shopify / erb_lint

Lint your ERB or HTML files
MIT License
664 stars 122 forks source link

Rubocop not working in `if` expression. #332

Open ryush00 opened 12 months ago

ryush00 commented 12 months ago

Hello,

The code in the if statement is not properly Rubocop linted. Since it's splitting the code into multiple lines to run ruby-parse, it doesn't seem to lint correctly if the end code is on a different line, like an if statement.

I have tested with this method.

<!-- test.html.erb -->
<% if I18n.locale=='ko' %>
    test
<% else %>
    test2
<% end %>
@diagnostics=[#<Parser::Diagnostic:0x00007f06724512d8
@level=:error,
@reason=:unexpected_token,
@arguments={:token=>"$end"},
@location=#<Parser::Source::Range /workspace/app/views/application/test.html.erb 23...23>, @highlights=[]>]

I think it can also occur on multi-line cause. (including Block, Proc, Lambda)