-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Lint/NestedMethodDefinition does not know about instance_exec and friends #4185
Comments
…ethods This cop would incorrectly register an offense encountering a nested method definition within a `#*_exec` method, which scopes the definition to the instance, class, or module. This change fixes that.
@Drenmi @bbatsov Thanks a lot for the fix. One case is not covered though (I take the blame for not including it explicitly in the title of this issue but only in the description): class Foo
def x(obj)
class << obj
def y
end
end
end
end
Shall I open another issue for this? |
@buehmann: This is a bit of a cross cutting concern. I'm working on a node extension for Please feel free to open an issue though. The more traceability, the better. 🙂 |
Okay, thanks. Done. |
Lint/NestedMethodDefinition allows methods to be nested in cases like these:
On the other hand it complains about the following similar cases where the
_exec
variant of the_eval
methods is used or a singleton class is opened viaclass <<
:Expected behavior
I expect Lint/NestedMethodDefinition not to complain about these cases.
RuboCop version
The text was updated successfully, but these errors were encountered: