Skip to content

Commit 5fc99e6

Browse files
committed
Suppress RuboCop's offense
This commit suppresses the fllowing RuboCop's offense: ```console $ bundle exec rubocop (snip) Offenses: lib/rubocop/cop/performance/map_compact.rb:72:41: C: [Correctable] InternalAffairs/LocationExists: Use chained_method&.loc?(:selector) instead of chained_method&.loc.respond_to?(:selector). if compact_node.multiline? && chained_method&.loc.respond_to?(:selector) && use_dot?(chained_method) && ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` 123 files inspected, 1 offense detected, 1 offense autocorrectable
1 parent ae0059a commit 5fc99e6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/rubocop/cop/performance/map_compact.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def on_send(node)
6969
def remove_compact_method(corrector, map_node, compact_node, chained_method)
7070
compact_method_range = compact_node.loc.selector
7171

72-
if compact_node.multiline? && chained_method&.loc.respond_to?(:selector) && use_dot?(chained_method) &&
72+
if compact_node.multiline? && chained_method&.loc?(:selector) && use_dot?(chained_method) &&
7373
!map_method_and_compact_method_on_same_line?(map_node, compact_node) &&
7474
!invoke_method_after_map_compact_on_same_line?(compact_node, chained_method)
7575
compact_method_range = compact_method_with_final_newline_range(compact_method_range)

0 commit comments

Comments
 (0)