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

Style/ClassMethods gets singleton methods wrong #1610

Closed
zenspider opened this issue Jan 27, 2015 · 4 comments
Closed

Style/ClassMethods gets singleton methods wrong #1610

zenspider opened this issue Jan 27, 2015 · 4 comments

Comments

@zenspider
Copy link

    UNDEFINED = Object.new # :nodoc:

    def UNDEFINED.inspect # :nodoc:
      "UNDEFINED" # again with the rdoc bugs... :(
    end
@bbatsov
Copy link
Collaborator

bbatsov commented Feb 1, 2015

Could you elaborate on the nature of the problem? This code should be ignored by Style/ClassMethods.

@zenspider
Copy link
Author

Inspecting 14 files
..C...........

Offenses:

lib/minitest/assertions.rb:19:9: C: Use self.inspect instead of UNDEFINED.inspect.
    def UNDEFINED.inspect # :nodoc:
        ^^^^^^^^^

@zenspider
Copy link
Author

Sorry, I should have included the output.

@bbatsov
Copy link
Collaborator

bbatsov commented Feb 1, 2015

Ah, I think I get it now. We're currently walking through all static method definitions inside the bodies of classes and modules and check if their names are prefixed with a constant (but we don't care what that constant is as we've assumed it's the class/module name). We should actually check if that constant is the name of the containing class/module.

@bbatsov bbatsov closed this as completed in 2a50668 Feb 1, 2015
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

2 participants