From f4f698c1055263a40b7fae5a4f98a331a8bd4ca2 Mon Sep 17 00:00:00 2001 From: Benjamin Quorning Date: Wed, 18 Sep 2024 10:49:03 +0200 Subject: [PATCH] Fix InternalAffairs/RedundantSourceRange offenses --- lib/rubocop/cop/rspec/change_by_zero.rb | 4 ++-- lib/rubocop/cop/rspec/expect_actual.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/rubocop/cop/rspec/change_by_zero.rb b/lib/rubocop/cop/rspec/change_by_zero.rb index d37ddd4dd..1ee9a40b7 100644 --- a/lib/rubocop/cop/rspec/change_by_zero.rb +++ b/lib/rubocop/cop/rspec/change_by_zero.rb @@ -104,12 +104,12 @@ def on_send(node) # rubocop:disable Metrics/MethodLength def register_offense(node, change_node) if compound_expectations?(node) - add_offense(node.source_range, + add_offense(node, message: message_compound(change_node)) do |corrector| autocorrect_compound(corrector, node) end else - add_offense(node.source_range, + add_offense(node, message: message(change_node)) do |corrector| autocorrect(corrector, node, change_node) end diff --git a/lib/rubocop/cop/rspec/expect_actual.rb b/lib/rubocop/cop/rspec/expect_actual.rb index 7a15aa25d..7aeb0fa81 100644 --- a/lib/rubocop/cop/rspec/expect_actual.rb +++ b/lib/rubocop/cop/rspec/expect_actual.rb @@ -69,7 +69,7 @@ def on_send(node) # rubocop:disable Metrics/MethodLength expect_literal(node) do |actual, send_node, matcher, expected| next if SKIPPED_MATCHERS.include?(matcher) - add_offense(actual.source_range) do |corrector| + add_offense(actual) do |corrector| next unless CORRECTABLE_MATCHERS.include?(matcher) next if literal?(expected)