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

Style/RedundantReturn doesn't detect offenses if an ensure block is present #5401

Closed
jturkel opened this issue Jan 5, 2018 · 2 comments
Closed
Labels

Comments

@jturkel
Copy link

jturkel commented Jan 5, 2018

The Style/RedundantReturn cop doesn't detect offenses if an ensure block is present in a method.


Expected behavior

Redundant returns should be flagged as an offense even if the method has an ensure block.

Actual behavior

No offenses are detected.

Steps to reproduce the problem

The following code should trigger an offense:

class Foo
  def bar
    return nil
  ensure
    nil
  end
end

RuboCop version

$ rubocop -V
0.52.1
@Drenmi Drenmi added the bug label Jan 5, 2018
@asherkach
Copy link
Contributor

This seems to be a generalization of this comment in the cop that indicates the cop should be generalized to cover a wider footprint.

@asherkach
Copy link
Contributor

Fix (this and related issues) forthcoming...

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

3 participants