class RuboCop::Cop::Sorbet::VoidCheckedTests
def on_signature(node)
def on_signature(node) checked_send = checked_tests(node).first return unless checked_send if (parent = node.parent) && (sibling_index = node.sibling_index) later_siblings = parent.children[(sibling_index + 1)..] if (def_node = later_siblings.find { |sibling| sibling.is_a?(RuboCop::AST::DefNode) }) # Sorbet requires that `initialize` methods return `.void` # (A stylistic convention which happens to be enforced by Sorbet) return if def_node.method?(:initialize) end end void_send = top_level_void(node.body) return unless void_send add_offense( void_send.selector, message: MESSAGE, ) do |corrector| corrector.replace(void_send.selector, "returns(T.anything)") end end