Skip to content

Unsuitably suggests making initialize a predicate #14493

@forthrin

Description

@forthrin

Steps to reproduce the problem

# Foo
class Foo < Set
  def initialize
    super
    add?('Default')
  end
end

pp Foo.new

Actual behavior

Predicate method names should end with `?`. [Naming/PredicateMethod]

Suggested behavior

No warning.

  1. No other types are complained about. Thus it seems understood that they are statements, never return values.
  2. It seems the root cause is a simple oversight of not excluding initialize when implementing the cop.

RuboCop version

ruby      2025-08-01 30a20bc16
rubocop   2025-08-12 c34098ee0
System Version: macOS 15.6 (24G84)
Model Identifier: MacBookAir10,1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions