rubocop / rubocop-ast

RuboCop's AST extensions and NodePattern functionality
https://docs.rubocop.org/rubocop-ast
MIT License
104 stars 52 forks source link

Fix `RuboCop::AST::DefNode#void_context?` to handle class methods called `initialize` #310

Closed vlad-pisanov closed 1 month ago

vlad-pisanov commented 2 months ago

Currently, DefNode#void_context? incorrectly returns true for class methods called initialize. This PR fixes this.

# constructor: void context ✔️ 
def initialize
  42
end

# class method: not void context! ❌ 
def self.initialize
  42
end
marcandre commented 1 month ago

Sorry for the delay, I missed the notification.

Thanks for the PR 👍

My cell phone just died on me, so I can't release right now, but will in a few days.

koic commented 1 month ago

@marcandre If you’d like, I can go ahead and handle the release. Shall I handle the release?

marcandre commented 1 month ago

Sure, that'd be great, thanks @koic ❤️

koic commented 1 month ago

RuboCop AST 1.32.3 has been released. I hope your cell phone gets fixed soon :-) https://rubygems.org/gems/rubocop-ast/versions/1.32.3