Skip to content

Commit f935a0b

Browse files
committed
Suppress new RuboCop offenses
Follow up rubocop/rubocop#13242 This commit removes the following redundant `source_range` to suppress new RuboCop offenses: ```console $ bundle exec rake (snip) Offenses: lib/rubocop/cop/rails/redundant_foreign_key.rb:43:44: C: [Corrected] InternalAffairs/RedundantSourceRange: Remove the redundant source_range. add_offense(foreign_key_pair.source_range) do |corrector| ^^^^^^^^^^^^ lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb:81:34: C: [Corrected] InternalAffairs/RedundantSourceRange: Remove the redundant source_range. add_offense(receiver.source_range) do |corrector| ^^^^^^^^^^^^ lib/rubocop/cop/rails/reflection_class_name.rb:46:47: C: [Corrected] InternalAffairs/RedundantSourceRange: Remove the redundant source_range. add_offense(reflection_class_name.source_range) do |corrector| ^^^^^^^^^^^^ lib/rubocop/cop/rails/request_referer.rb:37:30: C: [Corrected] InternalAffairs/RedundantSourceRange: Remove the redundant source_range. add_offense(node.source_range) do |corrector| ^^^^^^^^^^^^ 296 files inspected, 4 offenses detected, 4 offenses corrected ```
1 parent 4a00257 commit f935a0b

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

lib/rubocop/cop/rails/redundant_foreign_key.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class RedundantForeignKey < Base
4040
def on_send(node)
4141
association_with_foreign_key(node) do |type, name, options, foreign_key_pair, foreign_key|
4242
if redundant?(node, type, name, options, foreign_key)
43-
add_offense(foreign_key_pair.source_range) do |corrector|
43+
add_offense(foreign_key_pair) do |corrector|
4444
range = range_with_surrounding_space(foreign_key_pair.source_range, side: :left)
4545
range = range_with_surrounding_comma(range, :left)
4646

lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def on_block(node)
7878

7979
send_nodes.each do |send_node|
8080
receiver = send_node.receiver
81-
add_offense(receiver.source_range) do |corrector|
81+
add_offense(receiver) do |corrector|
8282
autocorrect(corrector, send_node, node)
8383
end
8484
end

lib/rubocop/cop/rails/reflection_class_name.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def on_send(node)
4343
return if reflection_class_name.value.send_type? && reflection_class_name.value.receiver.nil?
4444
return if reflection_class_name.value.lvar_type? && str_assigned?(reflection_class_name)
4545

46-
add_offense(reflection_class_name.source_range) do |corrector|
46+
add_offense(reflection_class_name) do |corrector|
4747
autocorrect(corrector, reflection_class_name)
4848
end
4949
end

lib/rubocop/cop/rails/request_referer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def on_send(node)
3434
referer?(node) do
3535
return unless node.method?(wrong_method_name)
3636

37-
add_offense(node.source_range) do |corrector|
37+
add_offense(node) do |corrector|
3838
corrector.replace(node, "request.#{style}")
3939
end
4040
end

0 commit comments

Comments
 (0)