-
-
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/UselessAccessModifier not recognizing delegated methods #2731
Comments
@bbatsov didn't agree to merge a fix for this issue, as he doesn't want Rails-specific stuff built into RuboCop. Our goal is to get all Rails-related code out of RC core and into some kind of plugin. |
I see. Thanks a lot for taking the time to review this :) |
To be more specific - I'm fine with making this particular cop configurable, but I'm not OK with hardcoding Rails specific stuff in generic Ruby cops. |
@bbatsov should I re-open this? |
I've reopened it. If you're up for a bit of hacking you can make the cop configurable yourself. It's pretty easy, but unfortunately I'm extremely short on time. |
I've been thinking a bit about this one, and can off the top of my head see two routes we could take.
I'm leaning towards option 2. What do you think @alexdowad, @bbatsov? |
Option 2 is better. |
This addresses the issue raised in rubocop#2731 where methods (often from outside of Ruby itself) may be called within the context of a module that in turn define methods. The `Lint/UselessAccessModifier` wasn’t taking these into account. Much like the existing approach taken with blocks/context-creating methods, there’s now a configuration option `MethodCreatingMethods` for the cop. This setting is an array of methods which, when called, are known to create other methods in the module’s current access context.
Hi,
The
Lint/UselessAccessModifier
cop doesn't recognize delegated method's (using ActiveSupport).It considers the following
private
useless.The text was updated successfully, but these errors were encountered: