class RuboCop::Cop::Lint::KernelIntegerWithoutBase
This cop checks for calls to Kernel.#Integer without a base.
Constants
- MSG
Public Instance Methods
on_send(node)
click to toggle source
# 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
Private Instance Methods
check_args(args)
click to toggle source
# File lib/rubocop/cop/lint/kernel_integer_without_base.rb, line 25 def check_args(args) args.size < 2 end
check_receiver(receiver)
click to toggle source
# File lib/rubocop/cop/lint/kernel_integer_without_base.rb, line 20 def check_receiver(receiver) return true unless receiver receiver.const_type? && receiver.const_name == 'Kernel' end