Class: RuboCop::Cop::Lint::KernelIntegerWithoutBase

Inherits:
RuboCop::Cop
  • Object
show all
Defined in:
lib/rubocop/cop/lint/kernel_integer_without_base.rb

Overview

This cop checks for calls to Kernel.#Integer without a base.

Constant Summary collapse

MSG =
'Specify a base as 2nd arg. e.g. `Integer(str, base)`.'.freeze

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/rubocop/cop/lint/kernel_integer_without_base.rb', line 8

def on_send(node)
  receiver, method_name, *args = *node

  return unless method_name == :Integer
  return unless check_receiver(receiver)
  return unless check_args(args)

  add_offense(node, :expression)
end