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

Layout/RescueEnsureAlignment false positive for rescue in block (Ruby 2.5) inside method #5315

Closed
AlexWayfer opened this issue Dec 26, 2017 · 0 comments
Assignees
Labels

Comments

@AlexWayfer
Copy link
Contributor

When we're using resuce inside a block (each, for example) — there are no offenses.

But when this block inside a method — there is incorrect offense.


Expected behavior

No offenses for rescue inside a block inside a method.

Actual behavior

Offense from Layout/RescueEnsureAlignment:

C: Layout/RescueEnsureAlignment: rescue at 4, 2 is not aligned with end at 7, 0.
  rescue StandardError => _exception
  ^^^^^^

Steps to reproduce the problem

def foo
  [1, 2, 3].each do |el|
    el.to_s
  rescue StandardError => _exception
    next
  end
end

RuboCop version

Include the output of rubocop -V. Here's an example:

$ rubocop -V
0.52.0 (using Parser 2.4.0.2, running on ruby 2.5.0 x86_64-linux)
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