class RuboCop::Cop::InternalAffairs::RedundantExpectOffenseArguments

Checks for redundant arguments of ‘RuboCop::RSpec::ExpectOffense`’s methods.

@example

# bad
expect_no_offenses('code', keyword: keyword)

# good
expect_no_offenses('code')

Constants

MSG
RESTRICT_ON_SEND

Public Instance Methods

on_send(node) click to toggle source
# File lib/rubocop/cop/internal_affairs/redundant_expect_offense_arguments.rb, line 22
def on_send(node)
  return if node.arguments.one? || !node.arguments[1]&.hash_type?

  range = node.first_argument.source_range.end.join(node.last_argument.source_range.end)

  add_offense(range) do |corrector|
    corrector.remove(range)
  end
end