rubocop-performance 1.7.1 → 1.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/config/default.yml +46 -7
- data/lib/rubocop/cop/mixin/regexp_metacharacter.rb +4 -4
- data/lib/rubocop/cop/performance/ancestors_include.rb +15 -13
- data/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb +77 -0
- data/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb +8 -12
- data/lib/rubocop/cop/performance/bind_call.rb +9 -18
- data/lib/rubocop/cop/performance/block_given_with_explicit_block.rb +52 -0
- data/lib/rubocop/cop/performance/caller.rb +14 -15
- data/lib/rubocop/cop/performance/case_when_splat.rb +18 -11
- data/lib/rubocop/cop/performance/casecmp.rb +13 -20
- data/lib/rubocop/cop/performance/chain_array_allocation.rb +24 -28
- data/lib/rubocop/cop/performance/collection_literal_in_loop.rb +140 -0
- data/lib/rubocop/cop/performance/compare_with_block.rb +10 -21
- data/lib/rubocop/cop/performance/constant_regexp.rb +68 -0
- data/lib/rubocop/cop/performance/count.rb +14 -16
- data/lib/rubocop/cop/performance/delete_prefix.rb +14 -22
- data/lib/rubocop/cop/performance/delete_suffix.rb +14 -22
- data/lib/rubocop/cop/performance/detect.rb +65 -32
- data/lib/rubocop/cop/performance/double_start_end_with.rb +16 -24
- data/lib/rubocop/cop/performance/end_with.rb +9 -13
- data/lib/rubocop/cop/performance/fixed_size.rb +2 -1
- data/lib/rubocop/cop/performance/flat_map.rb +21 -22
- data/lib/rubocop/cop/performance/inefficient_hash_search.rb +15 -14
- data/lib/rubocop/cop/performance/io_readlines.rb +27 -42
- data/lib/rubocop/cop/performance/method_object_as_block.rb +32 -0
- data/lib/rubocop/cop/performance/open_struct.rb +3 -2
- data/lib/rubocop/cop/performance/range_include.rb +8 -6
- data/lib/rubocop/cop/performance/redundant_block_call.rb +15 -10
- data/lib/rubocop/cop/performance/redundant_match.rb +12 -6
- data/lib/rubocop/cop/performance/redundant_merge.rb +19 -17
- data/lib/rubocop/cop/performance/redundant_sort_block.rb +6 -16
- data/lib/rubocop/cop/performance/redundant_string_chars.rb +10 -18
- data/lib/rubocop/cop/performance/regexp_match.rb +20 -20
- data/lib/rubocop/cop/performance/reverse_each.rb +13 -12
- data/lib/rubocop/cop/performance/reverse_first.rb +5 -10
- data/lib/rubocop/cop/performance/size.rb +7 -6
- data/lib/rubocop/cop/performance/sort_reverse.rb +6 -15
- data/lib/rubocop/cop/performance/squeeze.rb +8 -11
- data/lib/rubocop/cop/performance/start_with.rb +9 -13
- data/lib/rubocop/cop/performance/string_include.rb +11 -14
- data/lib/rubocop/cop/performance/string_replacement.rb +24 -27
- data/lib/rubocop/cop/performance/sum.rb +236 -0
- data/lib/rubocop/cop/performance/times_map.rb +12 -18
- data/lib/rubocop/cop/performance/unfreeze_string.rb +20 -2
- data/lib/rubocop/cop/performance/uri_default_parser.rb +7 -12
- data/lib/rubocop/cop/performance_cops.rb +6 -0
- data/lib/rubocop/performance/version.rb +6 -1
- metadata +25 -13
@@ -0,0 +1,236 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Performance
|
6
|
+
# This cop identifies places where custom code finding the sum of elements
|
7
|
+
# in some Enumerable object can be replaced by `Enumerable#sum` method.
|
8
|
+
#
|
9
|
+
# This cop can change auto-correction scope depending on the value of
|
10
|
+
# `SafeAutoCorrect`.
|
11
|
+
# Its auto-correction is marked as safe by default (`SafeAutoCorrect: true`)
|
12
|
+
# to prevent `TypeError` in auto-correced code when initial value is not
|
13
|
+
# specified as shown below:
|
14
|
+
#
|
15
|
+
# [source,ruby]
|
16
|
+
# ----
|
17
|
+
# ['a', 'b'].sum # => (String can't be coerced into Integer)
|
18
|
+
# ----
|
19
|
+
#
|
20
|
+
# Therefore if initial value is not specified, unsafe auto-corrected will not occur.
|
21
|
+
#
|
22
|
+
# If you always want to enable auto-correction, you can set `SafeAutoCorrect: false`.
|
23
|
+
#
|
24
|
+
# [source,yaml]
|
25
|
+
# ----
|
26
|
+
# Performance/Sum:
|
27
|
+
# SafeAutoCorrect: false
|
28
|
+
# ----
|
29
|
+
#
|
30
|
+
# Please note that the auto-correction command line option will be changed from
|
31
|
+
# `rubocop -a` to `rubocop -A`, which includes unsafe auto-correction.
|
32
|
+
#
|
33
|
+
# @example
|
34
|
+
# # bad
|
35
|
+
# [1, 2, 3].inject(:+) # These bad cases with no initial value are unsafe and
|
36
|
+
# [1, 2, 3].inject(&:+) # will not be auto-correced by default. If you want to
|
37
|
+
# [1, 2, 3].reduce { |acc, elem| acc + elem } # auto-corrected, you can set `SafeAutoCorrect: false`.
|
38
|
+
# [1, 2, 3].reduce(10, :+)
|
39
|
+
# [1, 2, 3].map { |elem| elem ** 2 }.sum
|
40
|
+
# [1, 2, 3].collect(&:count).sum(10)
|
41
|
+
#
|
42
|
+
# # good
|
43
|
+
# [1, 2, 3].sum
|
44
|
+
# [1, 2, 3].sum(10)
|
45
|
+
# [1, 2, 3].sum { |elem| elem ** 2 }
|
46
|
+
# [1, 2, 3].sum(10, &:count)
|
47
|
+
#
|
48
|
+
class Sum < Base
|
49
|
+
include RangeHelp
|
50
|
+
extend AutoCorrector
|
51
|
+
|
52
|
+
MSG = 'Use `%<good_method>s` instead of `%<bad_method>s`.'
|
53
|
+
MSG_IF_NO_INIT_VALUE =
|
54
|
+
'Use `%<good_method>s` instead of `%<bad_method>s`, unless calling `%<bad_method>s` on an empty array.'
|
55
|
+
RESTRICT_ON_SEND = %i[inject reduce sum].freeze
|
56
|
+
|
57
|
+
def_node_matcher :sum_candidate?, <<~PATTERN
|
58
|
+
(send _ ${:inject :reduce} $_init ? ${(sym :+) (block_pass (sym :+))})
|
59
|
+
PATTERN
|
60
|
+
|
61
|
+
def_node_matcher :sum_map_candidate?, <<~PATTERN
|
62
|
+
(send
|
63
|
+
{
|
64
|
+
(block $(send _ {:map :collect}) ...)
|
65
|
+
$(send _ {:map :collect} (block_pass _))
|
66
|
+
}
|
67
|
+
:sum $_init ?)
|
68
|
+
PATTERN
|
69
|
+
|
70
|
+
def_node_matcher :sum_with_block_candidate?, <<~PATTERN
|
71
|
+
(block
|
72
|
+
$(send _ {:inject :reduce} $_init ?)
|
73
|
+
(args (arg $_acc) (arg $_elem))
|
74
|
+
$send)
|
75
|
+
PATTERN
|
76
|
+
|
77
|
+
def_node_matcher :acc_plus_elem?, <<~PATTERN
|
78
|
+
(send (lvar %1) :+ (lvar %2))
|
79
|
+
PATTERN
|
80
|
+
alias elem_plus_acc? acc_plus_elem?
|
81
|
+
|
82
|
+
def on_send(node)
|
83
|
+
return if empty_array_literal?(node)
|
84
|
+
|
85
|
+
handle_sum_candidate(node)
|
86
|
+
handle_sum_map_candidate(node)
|
87
|
+
end
|
88
|
+
|
89
|
+
def on_block(node)
|
90
|
+
sum_with_block_candidate?(node) do |send, init, var_acc, var_elem, body|
|
91
|
+
if acc_plus_elem?(body, var_acc, var_elem) || elem_plus_acc?(body, var_elem, var_acc)
|
92
|
+
range = sum_block_range(send, node)
|
93
|
+
message = build_block_message(send, init, var_acc, var_elem, body)
|
94
|
+
|
95
|
+
add_offense(range, message: message) do |corrector|
|
96
|
+
autocorrect(corrector, init, range)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
private
|
103
|
+
|
104
|
+
def handle_sum_candidate(node)
|
105
|
+
sum_candidate?(node) do |method, init, operation|
|
106
|
+
range = sum_method_range(node)
|
107
|
+
message = build_method_message(node, method, init, operation)
|
108
|
+
|
109
|
+
add_offense(range, message: message) do |corrector|
|
110
|
+
autocorrect(corrector, init, range)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def handle_sum_map_candidate(node)
|
116
|
+
sum_map_candidate?(node) do |map, init|
|
117
|
+
next if node.block_literal? || node.block_argument?
|
118
|
+
|
119
|
+
message = build_sum_map_message(map.method_name, init)
|
120
|
+
|
121
|
+
add_offense(sum_map_range(map, node), message: message) do |corrector|
|
122
|
+
autocorrect_sum_map(corrector, node, map, init)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
def empty_array_literal?(node)
|
128
|
+
receiver = node.children.first
|
129
|
+
array_literal?(node) && receiver && receiver.children.empty?
|
130
|
+
end
|
131
|
+
|
132
|
+
def array_literal?(node)
|
133
|
+
receiver = node.children.first
|
134
|
+
receiver&.literal? && receiver&.array_type?
|
135
|
+
end
|
136
|
+
|
137
|
+
def autocorrect(corrector, init, range)
|
138
|
+
return if init.empty? && safe_autocorrect?
|
139
|
+
|
140
|
+
replacement = build_good_method(init)
|
141
|
+
|
142
|
+
corrector.replace(range, replacement)
|
143
|
+
end
|
144
|
+
|
145
|
+
def autocorrect_sum_map(corrector, sum, map, init)
|
146
|
+
sum_range = method_call_with_args_range(sum)
|
147
|
+
map_range = method_call_with_args_range(map)
|
148
|
+
|
149
|
+
block_pass = map.last_argument if map.last_argument&.block_pass_type?
|
150
|
+
replacement = build_good_method(init, block_pass)
|
151
|
+
|
152
|
+
corrector.remove(sum_range)
|
153
|
+
corrector.replace(map_range, ".#{replacement}")
|
154
|
+
end
|
155
|
+
|
156
|
+
def sum_method_range(node)
|
157
|
+
range_between(node.loc.selector.begin_pos, node.loc.end.end_pos)
|
158
|
+
end
|
159
|
+
|
160
|
+
def sum_map_range(map, sum)
|
161
|
+
range_between(map.loc.selector.begin_pos, sum.source_range.end.end_pos)
|
162
|
+
end
|
163
|
+
|
164
|
+
def sum_block_range(send, node)
|
165
|
+
range_between(send.loc.selector.begin_pos, node.loc.end.end_pos)
|
166
|
+
end
|
167
|
+
|
168
|
+
def build_method_message(node, method, init, operation)
|
169
|
+
good_method = build_good_method(init)
|
170
|
+
bad_method = build_method_bad_method(init, method, operation)
|
171
|
+
msg = if init.empty? && !array_literal?(node)
|
172
|
+
MSG_IF_NO_INIT_VALUE
|
173
|
+
else
|
174
|
+
MSG
|
175
|
+
end
|
176
|
+
format(msg, good_method: good_method, bad_method: bad_method)
|
177
|
+
end
|
178
|
+
|
179
|
+
def build_sum_map_message(method, init)
|
180
|
+
sum_method = build_good_method(init)
|
181
|
+
good_method = "#{sum_method} { ... }"
|
182
|
+
bad_method = "#{method} { ... }.#{sum_method}"
|
183
|
+
format(MSG, good_method: good_method, bad_method: bad_method)
|
184
|
+
end
|
185
|
+
|
186
|
+
def build_block_message(send, init, var_acc, var_elem, body)
|
187
|
+
good_method = build_good_method(init)
|
188
|
+
bad_method = build_block_bad_method(send.method_name, init, var_acc, var_elem, body)
|
189
|
+
format(MSG, good_method: good_method, bad_method: bad_method)
|
190
|
+
end
|
191
|
+
|
192
|
+
def build_good_method(init, block_pass = nil)
|
193
|
+
good_method = 'sum'
|
194
|
+
|
195
|
+
args = []
|
196
|
+
unless init.empty?
|
197
|
+
init = init.first
|
198
|
+
args << init.source unless init.int_type? && init.value.zero?
|
199
|
+
end
|
200
|
+
args << block_pass.source if block_pass
|
201
|
+
good_method += "(#{args.join(', ')})" unless args.empty?
|
202
|
+
good_method
|
203
|
+
end
|
204
|
+
|
205
|
+
def build_method_bad_method(init, method, operation)
|
206
|
+
bad_method = "#{method}("
|
207
|
+
unless init.empty?
|
208
|
+
init = init.first
|
209
|
+
bad_method += "#{init.source}, "
|
210
|
+
end
|
211
|
+
bad_method += if operation.block_pass_type?
|
212
|
+
'&:+)'
|
213
|
+
else
|
214
|
+
':+)'
|
215
|
+
end
|
216
|
+
bad_method
|
217
|
+
end
|
218
|
+
|
219
|
+
def build_block_bad_method(method, init, var_acc, var_elem, body)
|
220
|
+
bad_method = method.to_s
|
221
|
+
|
222
|
+
unless init.empty?
|
223
|
+
init = init.first
|
224
|
+
bad_method += "(#{init.source})"
|
225
|
+
end
|
226
|
+
bad_method += " { |#{var_acc}, #{var_elem}| #{body.source} }"
|
227
|
+
bad_method
|
228
|
+
end
|
229
|
+
|
230
|
+
def method_call_with_args_range(node)
|
231
|
+
node.receiver.source_range.end.join(node.source_range.end)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
@@ -17,10 +17,13 @@ module RuboCop
|
|
17
17
|
# Array.new(9) do |i|
|
18
18
|
# i.to_s
|
19
19
|
# end
|
20
|
-
class TimesMap <
|
20
|
+
class TimesMap < Base
|
21
|
+
extend AutoCorrector
|
22
|
+
|
21
23
|
MESSAGE = 'Use `Array.new(%<count>s)` with a block ' \
|
22
24
|
'instead of `.times.%<map_or_collect>s`'
|
23
25
|
MESSAGE_ONLY_IF = 'only if `%<count>s` is always 0 or more'
|
26
|
+
RESTRICT_ON_SEND = %i[map collect].freeze
|
24
27
|
|
25
28
|
def on_send(node)
|
26
29
|
check(node)
|
@@ -30,35 +33,26 @@ module RuboCop
|
|
30
33
|
check(node)
|
31
34
|
end
|
32
35
|
|
33
|
-
def autocorrect(node)
|
34
|
-
map_or_collect, count = times_map_call(node)
|
35
|
-
|
36
|
-
replacement =
|
37
|
-
"Array.new(#{count.source}" \
|
38
|
-
"#{map_or_collect.arguments.map { |arg| ", #{arg.source}" }.join})"
|
39
|
-
|
40
|
-
lambda do |corrector|
|
41
|
-
corrector.replace(map_or_collect.loc.expression, replacement)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
36
|
private
|
46
37
|
|
47
38
|
def check(node)
|
48
39
|
times_map_call(node) do |map_or_collect, count|
|
49
|
-
add_offense(node, message: message(map_or_collect, count))
|
40
|
+
add_offense(node, message: message(map_or_collect, count)) do |corrector|
|
41
|
+
replacement = "Array.new(#{count.source}" \
|
42
|
+
"#{map_or_collect.arguments.map { |arg| ", #{arg.source}" }.join})"
|
43
|
+
|
44
|
+
corrector.replace(map_or_collect.loc.expression, replacement)
|
45
|
+
end
|
50
46
|
end
|
51
47
|
end
|
52
48
|
|
53
49
|
def message(map_or_collect, count)
|
54
50
|
template = if count.literal?
|
55
|
-
MESSAGE
|
51
|
+
"#{MESSAGE}."
|
56
52
|
else
|
57
53
|
"#{MESSAGE} #{MESSAGE_ONLY_IF}."
|
58
54
|
end
|
59
|
-
format(template,
|
60
|
-
count: count.source,
|
61
|
-
map_or_collect: map_or_collect.method_name)
|
55
|
+
format(template, count: count.source, map_or_collect: map_or_collect.method_name)
|
62
56
|
end
|
63
57
|
|
64
58
|
def_node_matcher :times_map_call, <<~PATTERN
|
@@ -10,6 +10,7 @@ module RuboCop
|
|
10
10
|
# NOTE: `String.new` (without operator) is not exactly the same as `+''`.
|
11
11
|
# These differ in encoding. `String.new.encoding` is always `ASCII-8BIT`.
|
12
12
|
# However, `(+'').encoding` is the same as script encoding(e.g. `UTF-8`).
|
13
|
+
# Therefore, auto-correction is unsafe.
|
13
14
|
# So, if you expect `ASCII-8BIT` encoding, disable this cop.
|
14
15
|
#
|
15
16
|
# @example
|
@@ -23,8 +24,11 @@ module RuboCop
|
|
23
24
|
# # good
|
24
25
|
# +'something'
|
25
26
|
# +''
|
26
|
-
class UnfreezeString <
|
27
|
+
class UnfreezeString < Base
|
28
|
+
extend AutoCorrector
|
29
|
+
|
27
30
|
MSG = 'Use unary plus to get an unfrozen string literal.'
|
31
|
+
RESTRICT_ON_SEND = %i[dup new].freeze
|
28
32
|
|
29
33
|
def_node_matcher :dup_string?, <<~PATTERN
|
30
34
|
(send {str dstr} :dup)
|
@@ -38,7 +42,21 @@ module RuboCop
|
|
38
42
|
PATTERN
|
39
43
|
|
40
44
|
def on_send(node)
|
41
|
-
|
45
|
+
return unless dup_string?(node) || string_new?(node)
|
46
|
+
|
47
|
+
add_offense(node) do |corrector|
|
48
|
+
corrector.replace(node, "+#{string_value(node)}")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def string_value(node)
|
55
|
+
if node.receiver.source == 'String' && node.method?(:new)
|
56
|
+
node.arguments.empty? ? "''" : node.first_argument.source
|
57
|
+
else
|
58
|
+
node.receiver.source
|
59
|
+
end
|
42
60
|
end
|
43
61
|
end
|
44
62
|
end
|
@@ -13,9 +13,12 @@ module RuboCop
|
|
13
13
|
# # good
|
14
14
|
# URI::DEFAULT_PARSER
|
15
15
|
#
|
16
|
-
class UriDefaultParser <
|
16
|
+
class UriDefaultParser < Base
|
17
|
+
extend AutoCorrector
|
18
|
+
|
17
19
|
MSG = 'Use `%<double_colon>sURI::DEFAULT_PARSER` instead of ' \
|
18
20
|
'`%<double_colon>sURI::Parser.new`.'
|
21
|
+
RESTRICT_ON_SEND = %i[new].freeze
|
19
22
|
|
20
23
|
def_node_matcher :uri_parser_new?, <<~PATTERN
|
21
24
|
(send
|
@@ -28,17 +31,9 @@ module RuboCop
|
|
28
31
|
double_colon = captured_value ? '::' : ''
|
29
32
|
message = format(MSG, double_colon: double_colon)
|
30
33
|
|
31
|
-
add_offense(node, message: message)
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
def autocorrect(node)
|
36
|
-
lambda do |corrector|
|
37
|
-
double_colon = uri_parser_new?(node) ? '::' : ''
|
38
|
-
|
39
|
-
corrector.replace(
|
40
|
-
node.loc.expression, "#{double_colon}URI::DEFAULT_PARSER"
|
41
|
-
)
|
34
|
+
add_offense(node, message: message) do |corrector|
|
35
|
+
corrector.replace(node.loc.expression, "#{double_colon}URI::DEFAULT_PARSER")
|
36
|
+
end
|
42
37
|
end
|
43
38
|
end
|
44
39
|
end
|
@@ -4,12 +4,16 @@ require_relative 'mixin/regexp_metacharacter'
|
|
4
4
|
require_relative 'mixin/sort_block'
|
5
5
|
|
6
6
|
require_relative 'performance/ancestors_include'
|
7
|
+
require_relative 'performance/array_semi_infinite_range_slice'
|
7
8
|
require_relative 'performance/big_decimal_with_numeric_argument'
|
8
9
|
require_relative 'performance/bind_call'
|
10
|
+
require_relative 'performance/block_given_with_explicit_block'
|
9
11
|
require_relative 'performance/caller'
|
10
12
|
require_relative 'performance/case_when_splat'
|
11
13
|
require_relative 'performance/casecmp'
|
14
|
+
require_relative 'performance/collection_literal_in_loop'
|
12
15
|
require_relative 'performance/compare_with_block'
|
16
|
+
require_relative 'performance/constant_regexp'
|
13
17
|
require_relative 'performance/count'
|
14
18
|
require_relative 'performance/delete_prefix'
|
15
19
|
require_relative 'performance/delete_suffix'
|
@@ -19,6 +23,7 @@ require_relative 'performance/end_with'
|
|
19
23
|
require_relative 'performance/fixed_size'
|
20
24
|
require_relative 'performance/flat_map'
|
21
25
|
require_relative 'performance/inefficient_hash_search'
|
26
|
+
require_relative 'performance/method_object_as_block'
|
22
27
|
require_relative 'performance/open_struct'
|
23
28
|
require_relative 'performance/range_include'
|
24
29
|
require_relative 'performance/io_readlines'
|
@@ -36,6 +41,7 @@ require_relative 'performance/squeeze'
|
|
36
41
|
require_relative 'performance/start_with'
|
37
42
|
require_relative 'performance/string_include'
|
38
43
|
require_relative 'performance/string_replacement'
|
44
|
+
require_relative 'performance/sum'
|
39
45
|
require_relative 'performance/times_map'
|
40
46
|
require_relative 'performance/unfreeze_string'
|
41
47
|
require_relative 'performance/uri_default_parser'
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-performance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
8
8
|
- Jonas Arvidsson
|
9
9
|
- Yuji Nakayama
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-01-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubocop
|
@@ -18,28 +18,34 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.90.0
|
22
|
+
- - "<"
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '2.0'
|
22
25
|
type: :runtime
|
23
26
|
prerelease: false
|
24
27
|
version_requirements: !ruby/object:Gem::Requirement
|
25
28
|
requirements:
|
26
29
|
- - ">="
|
27
30
|
- !ruby/object:Gem::Version
|
28
|
-
version: 0.
|
31
|
+
version: 0.90.0
|
32
|
+
- - "<"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '2.0'
|
29
35
|
- !ruby/object:Gem::Dependency
|
30
|
-
name:
|
36
|
+
name: rubocop-ast
|
31
37
|
requirement: !ruby/object:Gem::Requirement
|
32
38
|
requirements:
|
33
39
|
- - ">="
|
34
40
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
36
|
-
type: :
|
41
|
+
version: 0.4.0
|
42
|
+
type: :runtime
|
37
43
|
prerelease: false
|
38
44
|
version_requirements: !ruby/object:Gem::Requirement
|
39
45
|
requirements:
|
40
46
|
- - ">="
|
41
47
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
48
|
+
version: 0.4.0
|
43
49
|
description: |
|
44
50
|
A collection of RuboCop cops to check for performance optimizations
|
45
51
|
in Ruby code.
|
@@ -57,13 +63,17 @@ files:
|
|
57
63
|
- lib/rubocop/cop/mixin/regexp_metacharacter.rb
|
58
64
|
- lib/rubocop/cop/mixin/sort_block.rb
|
59
65
|
- lib/rubocop/cop/performance/ancestors_include.rb
|
66
|
+
- lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb
|
60
67
|
- lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb
|
61
68
|
- lib/rubocop/cop/performance/bind_call.rb
|
69
|
+
- lib/rubocop/cop/performance/block_given_with_explicit_block.rb
|
62
70
|
- lib/rubocop/cop/performance/caller.rb
|
63
71
|
- lib/rubocop/cop/performance/case_when_splat.rb
|
64
72
|
- lib/rubocop/cop/performance/casecmp.rb
|
65
73
|
- lib/rubocop/cop/performance/chain_array_allocation.rb
|
74
|
+
- lib/rubocop/cop/performance/collection_literal_in_loop.rb
|
66
75
|
- lib/rubocop/cop/performance/compare_with_block.rb
|
76
|
+
- lib/rubocop/cop/performance/constant_regexp.rb
|
67
77
|
- lib/rubocop/cop/performance/count.rb
|
68
78
|
- lib/rubocop/cop/performance/delete_prefix.rb
|
69
79
|
- lib/rubocop/cop/performance/delete_suffix.rb
|
@@ -74,6 +84,7 @@ files:
|
|
74
84
|
- lib/rubocop/cop/performance/flat_map.rb
|
75
85
|
- lib/rubocop/cop/performance/inefficient_hash_search.rb
|
76
86
|
- lib/rubocop/cop/performance/io_readlines.rb
|
87
|
+
- lib/rubocop/cop/performance/method_object_as_block.rb
|
77
88
|
- lib/rubocop/cop/performance/open_struct.rb
|
78
89
|
- lib/rubocop/cop/performance/range_include.rb
|
79
90
|
- lib/rubocop/cop/performance/redundant_block_call.rb
|
@@ -90,6 +101,7 @@ files:
|
|
90
101
|
- lib/rubocop/cop/performance/start_with.rb
|
91
102
|
- lib/rubocop/cop/performance/string_include.rb
|
92
103
|
- lib/rubocop/cop/performance/string_replacement.rb
|
104
|
+
- lib/rubocop/cop/performance/sum.rb
|
93
105
|
- lib/rubocop/cop/performance/times_map.rb
|
94
106
|
- lib/rubocop/cop/performance/unfreeze_string.rb
|
95
107
|
- lib/rubocop/cop/performance/uri_default_parser.rb
|
@@ -104,9 +116,9 @@ metadata:
|
|
104
116
|
homepage_uri: https://docs.rubocop.org/rubocop-performance/
|
105
117
|
changelog_uri: https://github.com/rubocop-hq/rubocop-performance/blob/master/CHANGELOG.md
|
106
118
|
source_code_uri: https://github.com/rubocop-hq/rubocop-performance/
|
107
|
-
documentation_uri: https://docs.rubocop.org/rubocop-performance/
|
119
|
+
documentation_uri: https://docs.rubocop.org/rubocop-performance/1.9/
|
108
120
|
bug_tracker_uri: https://github.com/rubocop-hq/rubocop-performance/issues
|
109
|
-
post_install_message:
|
121
|
+
post_install_message:
|
110
122
|
rdoc_options: []
|
111
123
|
require_paths:
|
112
124
|
- lib
|
@@ -121,8 +133,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
133
|
- !ruby/object:Gem::Version
|
122
134
|
version: '0'
|
123
135
|
requirements: []
|
124
|
-
rubygems_version: 3.
|
125
|
-
signing_key:
|
136
|
+
rubygems_version: 3.2.3
|
137
|
+
signing_key:
|
126
138
|
specification_version: 4
|
127
139
|
summary: Automatic performance checking tool for Ruby code.
|
128
140
|
test_files: []
|