-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Consider disallowing ivars in methods of any module #1
Comments
this would cause more false positives than it would correct catches don't you think? people include and prepend modules way more often than they extend them except for the is there a way code is capable of being analyzed for if it is being used as an extension? |
Hey @mikegee, do you have any thoughts on this after four years? 🙂 |
I'm scared of the false positives and don't want to pursue this. I appreciate the intentions and welcome another strategy to achieve that goal. |
I agree that there would be too many false positives. Static analysis is quite limited in this case, so I think we should close this. If someone is interested in revisiting it in the future, we could implement it as a disabled-by-default cop. |
This is a recreation of covermymeds/issues/22 opened by @biinari on Jun 22, 2020.
As an extension to the suggestion in covermymeds/issues/4, perhaps we should flag up ivars used in methods of any module.
This would unfortunately add some false positives as modules may be included in classes, making instance methods and hence would be using instance variables rather than class instance variables.
They could be individually checked by the user and ignored with a
rubocop:disable
comment. Or perhaps this should be an option to theInstanceVariableInClassMethod
, which may be set depending on how prevalent extending modules is in the user's codebase.Concerns I would like to catch would be:
False positives that would be difficult / impossible to rule out in a static analysis:
The text was updated successfully, but these errors were encountered: