class RuboCop::Cop::Style::OptionalBooleanParameter


end
puts bar
def some_method(bar = false)
# good
@example AllowedMethods: [‘some_method’]
end
puts bar
def some_method(bar: false)
# good
end
puts bar
bar = options.fetch(:bar, false)
def some_method(options = {})
# bad - common hack before keyword args were introduced
end
puts bar
def some_method(bar = false)
# bad
@example
These are customizable with ‘AllowedMethods` option.
boolean arguments when defining methods. `respond_to_missing?` method is allowed by default.
This cop checks for places where keyword arguments can be used instead of

def on_def(node)

def on_def(node)
  return if allowed_method?(node.method_name)
  node.arguments.each do |arg|
    next unless arg.optarg_type?
    _name, value = *arg
    add_offense(arg) if BOOLEAN_TYPES.include?(value.type)
  end
end