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

Non-local exit from iterator has a false positive with #define_singleton_method #3746

Closed
AlexWayfer opened this issue Nov 29, 2016 · 0 comments

Comments

@AlexWayfer
Copy link
Contributor

Hello!

I have a code:

str = 'foo'
str.define_singleton_method :bar do |baz|
  return unless baz
  replace baz
end

I think I can make PR for fixing this.


Expected behavior

No warnings from Rubocop.

Actual behavior

Warning about Non-local exit from iterator.

Steps to reproduce the problem

Check the file with this code (or similar) by Rubocop.

RuboCop version

$ rubocop -V
0.45.0 (using Parser 2.3.1.4, running on ruby 2.3.3 x86_64-linux)
AlexWayfer added a commit to AlexWayfer/rubocop that referenced this issue Nov 29, 2016
… block passed to `Object#define_singleton_method`

`return`s don't cause problems in blocks passed to `define_singleton_method`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant