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

Fix Module with initialize method #1746

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JuanVqz
Copy link
Contributor

@JuanVqz JuanVqz commented Oct 18, 2023

Fixes #1505

@JuanVqz JuanVqz force-pushed the fix_module_initialize branch 2 times, most recently from 476f9ec to 47c9730 Compare October 18, 2023 23:35
@JuanVqz JuanVqz changed the title Fix Module Initialize when nesting classes Fix Module with initialize method Oct 18, 2023
@troessner
Copy link
Owner

1 small comment from my side, other than that, this looks great. Wdyt @mvz ?

@@ -21,14 +21,16 @@ def self.contexts # :nodoc:
# @return [Array<SmellWarning>]
#
def sniff
context.defined_instance_methods.each do |node|
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently, the cause of #1505 is that ModuleContext#defined_instance_methods includes methods from dynamically defined nested classes. Instead of dropping down to bare sexp manipulation, I think this method should be adjusted instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have any clue where can I start?

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

Successfully merging this pull request may close these issues.

False positive for ModuleInitialize
3 participants