rubocop-performance 1.11.4 → 1.11.5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fffd38c1ed7da6f4ff4f67b3f1d7d08bc60e8871dc22d4ac266de6facc04fcf
|
4
|
+
data.tar.gz: e0de1a9ec946e37b2654390d4b46a0b9f0e1afbc37fec464c6fd78001ad5e509
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4225a879e2e0421438be5d17bb38d982901709c809ed7ccda3a0095affaf77a707c5fb5657ee61b123546860f1e9f0bcf783ed706b8b17fba9114588a16b4653
|
7
|
+
data.tar.gz: 3af998bbda7046ae5a55f06bb1ecc941dff48901d94a791fd81963cc1d76adf39524600c7ff4633c3dc06f925a2d8ea7f57716f51de2079e971c10b6194e40bb
|
@@ -66,7 +66,7 @@ module RuboCop
|
|
66
66
|
chained_method = compact_node.parent
|
67
67
|
compact_method_range = compact_node.loc.selector
|
68
68
|
|
69
|
-
if compact_node.multiline? && chained_method&.loc.respond_to?(:selector) &&
|
69
|
+
if compact_node.multiline? && chained_method&.loc.respond_to?(:selector) && chained_method.dot? &&
|
70
70
|
!invoke_method_after_map_compact_on_same_line?(compact_node, chained_method)
|
71
71
|
compact_method_range = range_by_whole_lines(compact_method_range, include_final_newline: true)
|
72
72
|
else
|
@@ -74,12 +74,27 @@ module RuboCop
|
|
74
74
|
|
75
75
|
def new_argument(block_argument, block_body)
|
76
76
|
if block_argument.source == block_body.receiver.source
|
77
|
-
block_body.first_argument
|
77
|
+
rhs = block_body.first_argument
|
78
|
+
return if use_block_argument_in_method_argument_of_operand?(block_argument, rhs)
|
79
|
+
|
80
|
+
rhs.source
|
78
81
|
elsif block_argument.source == block_body.first_argument.source
|
79
|
-
block_body.receiver
|
82
|
+
lhs = block_body.receiver
|
83
|
+
return if use_block_argument_in_method_argument_of_operand?(block_argument, lhs)
|
84
|
+
|
85
|
+
lhs.source
|
80
86
|
end
|
81
87
|
end
|
82
88
|
|
89
|
+
def use_block_argument_in_method_argument_of_operand?(block_argument, operand)
|
90
|
+
return false unless operand.send_type?
|
91
|
+
|
92
|
+
arguments = operand.arguments
|
93
|
+
arguments.inject(arguments.map(&:source)) do |operand_sources, argument|
|
94
|
+
operand_sources + argument.each_descendant(:lvar).map(&:source)
|
95
|
+
end.any?(block_argument.source)
|
96
|
+
end
|
97
|
+
|
83
98
|
def offense_range(node)
|
84
99
|
node.send_node.loc.selector.join(node.source_range.end)
|
85
100
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-performance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.11.
|
4
|
+
version: 1.11.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-
|
13
|
+
date: 2021-08-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubocop
|