rubocop-performance 1.10.2 → 1.11.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/config/default.yml +17 -0
- data/config/obsoletion.yml +7 -0
- data/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb +5 -5
- data/lib/rubocop/cop/performance/case_when_splat.rb +4 -8
- data/lib/rubocop/cop/performance/chain_array_allocation.rb +2 -0
- data/lib/rubocop/cop/performance/collection_literal_in_loop.rb +1 -1
- data/lib/rubocop/cop/performance/delete_prefix.rb +2 -1
- data/lib/rubocop/cop/performance/delete_suffix.rb +2 -1
- data/lib/rubocop/cop/performance/detect.rb +4 -8
- data/lib/rubocop/cop/performance/flat_map.rb +2 -1
- data/lib/rubocop/cop/performance/map_compact.rb +85 -0
- data/lib/rubocop/cop/performance/redundant_merge.rb +3 -0
- data/lib/rubocop/cop/performance/redundant_string_chars.rb +7 -17
- data/lib/rubocop/cop/performance/regexp_match.rb +1 -2
- data/lib/rubocop/cop/performance/select_map.rb +60 -0
- data/lib/rubocop/cop/performance/unfreeze_string.rb +4 -1
- data/lib/rubocop/cop/performance_cops.rb +2 -0
- data/lib/rubocop/performance.rb +2 -0
- data/lib/rubocop/performance/version.rb +1 -1
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f8e6344d490eed1972435e9ce89e171634bff029196b42987d02ee02745ddce
|
4
|
+
data.tar.gz: 863428f02b2e9e387f40bc534775928035ca945d08cfdb8b6602b2765e67f074
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb7b9ea8f9626ea64dd44af1c3f6cc2e6141fdf6dc50b4f7aca09c88c11fe68b54a808cfaa2b0bed3a429f4614e85f84a724f833d5c767d7dc9fdc1f1a082014
|
7
|
+
data.tar.gz: a2b8d58a302ea4070e1ce702263806ca1fe3b9d7e3c9944156299c28d8df9ad311d321d202b4cdf02723dc6a331b6817604afea9d7e684e2c9a3cf4300763460
|
data/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/rubocop-performance.svg)](https://badge.fury.io/rb/rubocop-performance)
|
4
4
|
[![CircleCI](https://circleci.com/gh/rubocop/rubocop-performance.svg?style=svg)](https://circleci.com/gh/rubocop/rubocop-performance)
|
5
|
+
[![Discord](https://img.shields.io/badge/chat-on%20discord-7289da.svg?sanitize=true)](https://discord.gg/wJjWvGRDmm)
|
5
6
|
|
6
7
|
Performance optimization analysis for your projects, as an extension to [RuboCop](https://github.com/rubocop/rubocop).
|
7
8
|
|
data/config/default.yml
CHANGED
@@ -96,14 +96,18 @@ Performance/Count:
|
|
96
96
|
Performance/DeletePrefix:
|
97
97
|
Description: 'Use `delete_prefix` instead of `gsub`.'
|
98
98
|
Enabled: true
|
99
|
+
Safe: false
|
99
100
|
SafeMultiline: true
|
100
101
|
VersionAdded: '1.6'
|
102
|
+
VersionChanged: '1.11'
|
101
103
|
|
102
104
|
Performance/DeleteSuffix:
|
103
105
|
Description: 'Use `delete_suffix` instead of `gsub`.'
|
104
106
|
Enabled: true
|
107
|
+
Safe: false
|
105
108
|
SafeMultiline: true
|
106
109
|
VersionAdded: '1.6'
|
110
|
+
VersionChanged: '1.11'
|
107
111
|
|
108
112
|
Performance/Detect:
|
109
113
|
Description: >-
|
@@ -174,6 +178,12 @@ Performance/IoReadlines:
|
|
174
178
|
Enabled: false
|
175
179
|
VersionAdded: '1.7'
|
176
180
|
|
181
|
+
Performance/MapCompact:
|
182
|
+
Description: 'Use `filter_map` instead of `collection.map(&:do_something).compact`.'
|
183
|
+
Enabled: pending
|
184
|
+
SafeAutoCorrect: false
|
185
|
+
VersionAdded: '1.11'
|
186
|
+
|
177
187
|
Performance/MethodObjectAsBlock:
|
178
188
|
Description: 'Use block explicitly instead of block-passing a method object.'
|
179
189
|
Reference: 'https://github.com/JuanitoFatas/fast-ruby#normal-way-to-apply-method-vs-method-code'
|
@@ -220,7 +230,9 @@ Performance/RedundantMerge:
|
|
220
230
|
Description: 'Use Hash#[]=, rather than Hash#merge! with a single key-value pair.'
|
221
231
|
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashmerge-vs-hash-code'
|
222
232
|
Enabled: true
|
233
|
+
Safe: false
|
223
234
|
VersionAdded: '0.36'
|
235
|
+
VersionChanged: '1.11'
|
224
236
|
# Max number of key-value pairs to consider an offense
|
225
237
|
MaxKeyValuePairs: 2
|
226
238
|
|
@@ -258,6 +270,11 @@ Performance/ReverseFirst:
|
|
258
270
|
Enabled: 'pending'
|
259
271
|
VersionAdded: '1.7'
|
260
272
|
|
273
|
+
Performance/SelectMap:
|
274
|
+
Description: 'Use `filter_map` instead of `ary.select(&:foo).map(&:bar)`.'
|
275
|
+
Enabled: false
|
276
|
+
VersionAdded: '1.11'
|
277
|
+
|
261
278
|
Performance/Size:
|
262
279
|
Description: >-
|
263
280
|
Use `size` instead of `count` for counting
|
@@ -11,11 +11,11 @@ module RuboCop
|
|
11
11
|
#
|
12
12
|
# @example
|
13
13
|
# # bad
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
14
|
+
# array[..2]
|
15
|
+
# array[...2]
|
16
|
+
# array[2..]
|
17
|
+
# array[2...]
|
18
|
+
# array.slice(..2)
|
19
19
|
#
|
20
20
|
# # good
|
21
21
|
# array.take(3)
|
@@ -58,10 +58,8 @@ module RuboCop
|
|
58
58
|
include RangeHelp
|
59
59
|
extend AutoCorrector
|
60
60
|
|
61
|
-
MSG = 'Reordering `when` conditions with a splat to the end '
|
62
|
-
|
63
|
-
ARRAY_MSG = 'Pass the contents of array literals ' \
|
64
|
-
'directly to `when` conditions.'
|
61
|
+
MSG = 'Reordering `when` conditions with a splat to the end of the `when` branches can improve performance.'
|
62
|
+
ARRAY_MSG = 'Pass the contents of array literals directly to `when` conditions.'
|
65
63
|
|
66
64
|
def on_case(case_node)
|
67
65
|
when_conditions = case_node.when_branches.flat_map(&:conditions)
|
@@ -134,13 +132,11 @@ module RuboCop
|
|
134
132
|
end
|
135
133
|
|
136
134
|
def new_condition_with_then(node, new_condition)
|
137
|
-
"\n#{indent_for(node)}when "
|
138
|
-
"#{new_condition} then #{node.body.source}"
|
135
|
+
"\n#{indent_for(node)}when #{new_condition} then #{node.body.source}"
|
139
136
|
end
|
140
137
|
|
141
138
|
def new_branch_without_then(node, new_condition)
|
142
|
-
"\n#{indent_for(node)}when #{new_condition}"
|
143
|
-
"\n#{indent_for(node.body)}#{node.body.source}"
|
139
|
+
"\n#{indent_for(node)}when #{new_condition}\n#{indent_for(node.body)}#{node.body.source}"
|
144
140
|
end
|
145
141
|
|
146
142
|
def indent_for(node)
|
@@ -63,6 +63,8 @@ module RuboCop
|
|
63
63
|
|
64
64
|
def on_send(node)
|
65
65
|
chain_array_allocation?(node) do |fm, sm|
|
66
|
+
return if node.each_descendant(:send).any? { |descendant| descendant.method?(:lazy) }
|
67
|
+
|
66
68
|
range = range_between(node.loc.dot.begin_pos, node.source_range.end_pos)
|
67
69
|
|
68
70
|
add_offense(range, message: format(MSG, method: fm, second_method: sm))
|
@@ -33,7 +33,7 @@ module RuboCop
|
|
33
33
|
#
|
34
34
|
class CollectionLiteralInLoop < Base
|
35
35
|
MSG = 'Avoid immutable %<literal_class>s literals in loops. '\
|
36
|
-
|
36
|
+
'It is better to extract it into a local variable or a constant.'
|
37
37
|
|
38
38
|
POST_CONDITION_LOOP_TYPES = %i[while_post until_post].freeze
|
39
39
|
LOOP_TYPES = (POST_CONDITION_LOOP_TYPES + %i[while until for]).freeze
|
@@ -7,6 +7,7 @@ module RuboCop
|
|
7
7
|
#
|
8
8
|
# This cop identifies places where `gsub(/\Aprefix/, '')` and `sub(/\Aprefix/, '')`
|
9
9
|
# can be replaced by `delete_prefix('prefix')`.
|
10
|
+
# It is marked as unsafe by default because `Pathname` has `sub` but not `delete_prefix`.
|
10
11
|
#
|
11
12
|
# This cop has `SafeMultiline` configuration option that `true` by default because
|
12
13
|
# `^prefix` is unsafe as it will behave incompatible with `delete_prefix`
|
@@ -66,7 +67,7 @@ module RuboCop
|
|
66
67
|
|
67
68
|
def on_send(node)
|
68
69
|
return unless (receiver, bad_method, regexp_str, replace_string = delete_prefix_candidate?(node))
|
69
|
-
return unless replace_string.
|
70
|
+
return unless replace_string.empty?
|
70
71
|
|
71
72
|
good_method = PREFERRED_METHODS[bad_method]
|
72
73
|
|
@@ -7,6 +7,7 @@ module RuboCop
|
|
7
7
|
#
|
8
8
|
# This cop identifies places where `gsub(/suffix\z/, '')` and `sub(/suffix\z/, '')`
|
9
9
|
# can be replaced by `delete_suffix('suffix')`.
|
10
|
+
# It is marked as unsafe by default because `Pathname` has `sub` but not `delete_suffix`.
|
10
11
|
#
|
11
12
|
# This cop has `SafeMultiline` configuration option that `true` by default because
|
12
13
|
# `suffix$` is unsafe as it will behave incompatible with `delete_suffix?`
|
@@ -66,7 +67,7 @@ module RuboCop
|
|
66
67
|
|
67
68
|
def on_send(node)
|
68
69
|
return unless (receiver, bad_method, regexp_str, replace_string = delete_suffix_candidate?(node))
|
69
|
-
return unless replace_string.
|
70
|
+
return unless replace_string.empty?
|
70
71
|
|
71
72
|
good_method = PREFERRED_METHODS[bad_method]
|
72
73
|
|
@@ -31,14 +31,10 @@ module RuboCop
|
|
31
31
|
|
32
32
|
CANDIDATE_METHODS = Set[:select, :find_all, :filter].freeze
|
33
33
|
|
34
|
-
MSG = 'Use `%<prefer>s` instead of '
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
INDEX_MSG = 'Use `%<prefer>s` instead of ' \
|
39
|
-
'`%<first_method>s[%<index>i]`.'
|
40
|
-
INDEX_REVERSE_MSG = 'Use `reverse.%<prefer>s` instead of ' \
|
41
|
-
'`%<first_method>s[%<index>i]`.'
|
34
|
+
MSG = 'Use `%<prefer>s` instead of `%<first_method>s.%<second_method>s`.'
|
35
|
+
REVERSE_MSG = 'Use `reverse.%<prefer>s` instead of `%<first_method>s.%<second_method>s`.'
|
36
|
+
INDEX_MSG = 'Use `%<prefer>s` instead of `%<first_method>s[%<index>i]`.'
|
37
|
+
INDEX_REVERSE_MSG = 'Use `reverse.%<prefer>s` instead of `%<first_method>s[%<index>i]`.'
|
42
38
|
RESTRICT_ON_SEND = %i[first last []].freeze
|
43
39
|
|
44
40
|
def_node_matcher :detect_candidate?, <<~PATTERN
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Performance
|
6
|
+
# In Ruby 2.7, `Enumerable#filter_map` has been added.
|
7
|
+
#
|
8
|
+
# This cop identifies places where `map { ... }.compact` can be replaced by `filter_map`.
|
9
|
+
# It is marked as unsafe auto-correction by default because `map { ... }.compact`
|
10
|
+
# that is not compatible with `filter_map`.
|
11
|
+
#
|
12
|
+
# [source,ruby]
|
13
|
+
# ----
|
14
|
+
# [true, false, nil].compact #=> [true, false]
|
15
|
+
# [true, false, nil].filter_map(&:itself) #=> [true]
|
16
|
+
# ----
|
17
|
+
#
|
18
|
+
# @example
|
19
|
+
# # bad
|
20
|
+
# ary.map(&:foo).compact
|
21
|
+
# ary.collect(&:foo).compact
|
22
|
+
#
|
23
|
+
# # good
|
24
|
+
# ary.filter_map(&:foo)
|
25
|
+
# ary.map(&:foo).compact!
|
26
|
+
# ary.compact.map(&:foo)
|
27
|
+
#
|
28
|
+
class MapCompact < Base
|
29
|
+
include RangeHelp
|
30
|
+
extend AutoCorrector
|
31
|
+
extend TargetRubyVersion
|
32
|
+
|
33
|
+
MSG = 'Use `filter_map` instead.'
|
34
|
+
RESTRICT_ON_SEND = %i[compact].freeze
|
35
|
+
|
36
|
+
minimum_target_ruby_version 2.7
|
37
|
+
|
38
|
+
def_node_matcher :map_compact, <<~PATTERN
|
39
|
+
{
|
40
|
+
(send
|
41
|
+
$(send _ {:map :collect}
|
42
|
+
(block_pass
|
43
|
+
(sym _))) _)
|
44
|
+
(send
|
45
|
+
(block
|
46
|
+
$(send _ {:map :collect})
|
47
|
+
(args ...) _) _)
|
48
|
+
}
|
49
|
+
PATTERN
|
50
|
+
|
51
|
+
def on_send(node)
|
52
|
+
return unless (map_node = map_compact(node))
|
53
|
+
|
54
|
+
compact_loc = node.loc
|
55
|
+
range = range_between(map_node.loc.selector.begin_pos, compact_loc.selector.end_pos)
|
56
|
+
|
57
|
+
add_offense(range) do |corrector|
|
58
|
+
corrector.replace(map_node.loc.selector, 'filter_map')
|
59
|
+
remove_compact_method(corrector, node)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def remove_compact_method(corrector, compact_node)
|
66
|
+
chained_method = compact_node.parent
|
67
|
+
compact_method_range = compact_node.loc.selector
|
68
|
+
|
69
|
+
if compact_node.multiline? && chained_method&.loc.respond_to?(:selector) &&
|
70
|
+
!invoke_method_after_map_compact_on_same_line?(compact_node, chained_method)
|
71
|
+
compact_method_range = range_by_whole_lines(compact_method_range, include_final_newline: true)
|
72
|
+
else
|
73
|
+
corrector.remove(compact_node.loc.dot)
|
74
|
+
end
|
75
|
+
|
76
|
+
corrector.remove(compact_method_range)
|
77
|
+
end
|
78
|
+
|
79
|
+
def invoke_method_after_map_compact_on_same_line?(compact_node, chained_method)
|
80
|
+
compact_node.loc.selector.line == chained_method.loc.selector.line
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -8,6 +8,9 @@ module RuboCop
|
|
8
8
|
# You can set the maximum number of key-value pairs to consider
|
9
9
|
# an offense with `MaxKeyValuePairs`.
|
10
10
|
#
|
11
|
+
# This cop is marked as unsafe because RuboCop cannot determine if the
|
12
|
+
# receiver of `merge!` is actually a hash or not.
|
13
|
+
#
|
11
14
|
# @example
|
12
15
|
# # bad
|
13
16
|
# hash.merge!(a: 1)
|
@@ -16,35 +16,35 @@ module RuboCop
|
|
16
16
|
# # bad
|
17
17
|
# str.chars.first
|
18
18
|
# str.chars.first(2)
|
19
|
-
# str.chars.last
|
20
|
-
# str.chars.last(2)
|
21
19
|
#
|
22
20
|
# # good
|
23
21
|
# str[0]
|
24
22
|
# str[0...2].chars
|
25
|
-
# str[-1]
|
26
|
-
# str[-2..-1].chars
|
27
23
|
#
|
28
24
|
# # bad
|
29
25
|
# str.chars.take(2)
|
30
|
-
# str.chars.drop(2)
|
31
26
|
# str.chars.length
|
32
27
|
# str.chars.size
|
33
28
|
# str.chars.empty?
|
34
29
|
#
|
35
30
|
# # good
|
36
31
|
# str[0...2].chars
|
37
|
-
# str[2..-1].chars
|
38
32
|
# str.length
|
39
33
|
# str.size
|
40
34
|
# str.empty?
|
41
35
|
#
|
36
|
+
# # For example, if the receiver is a blank string, it will be incompatible.
|
37
|
+
# # If a negative value is specified for the receiver, `nil` is returned.
|
38
|
+
# str.chars.last # Incompatible with `str[-1]`.
|
39
|
+
# str.chars.last(2) # Incompatible with `str[-2..-1].chars`.
|
40
|
+
# str.chars.drop(2) # Incompatible with `str[2..-1].chars`.
|
41
|
+
#
|
42
42
|
class RedundantStringChars < Base
|
43
43
|
include RangeHelp
|
44
44
|
extend AutoCorrector
|
45
45
|
|
46
46
|
MSG = 'Use `%<good_method>s` instead of `%<bad_method>s`.'
|
47
|
-
RESTRICT_ON_SEND = %i[[] slice first
|
47
|
+
RESTRICT_ON_SEND = %i[[] slice first take length size empty?].freeze
|
48
48
|
|
49
49
|
def_node_matcher :redundant_chars_call?, <<~PATTERN
|
50
50
|
(send $(send _ :chars) $_ $...)
|
@@ -80,7 +80,6 @@ module RuboCop
|
|
80
80
|
format(MSG, good_method: good_method, bad_method: bad_method)
|
81
81
|
end
|
82
82
|
|
83
|
-
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength
|
84
83
|
def build_good_method(method, args)
|
85
84
|
case method
|
86
85
|
when :[], :slice
|
@@ -91,21 +90,12 @@ module RuboCop
|
|
91
90
|
else
|
92
91
|
'[0]'
|
93
92
|
end
|
94
|
-
when :last
|
95
|
-
if args.any?
|
96
|
-
"[-#{args.first.source}..-1].chars"
|
97
|
-
else
|
98
|
-
'[-1]'
|
99
|
-
end
|
100
93
|
when :take
|
101
94
|
"[0...#{args.first.source}].chars"
|
102
|
-
when :drop
|
103
|
-
"[#{args.first.source}..-1].chars"
|
104
95
|
else
|
105
96
|
".#{method}"
|
106
97
|
end
|
107
98
|
end
|
108
|
-
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/MethodLength
|
109
99
|
|
110
100
|
def build_bad_method(method, args)
|
111
101
|
case method
|
@@ -78,8 +78,7 @@ module RuboCop
|
|
78
78
|
# Constants are included in this list because it is unlikely that
|
79
79
|
# someone will store `nil` as a constant and then use it for comparison
|
80
80
|
TYPES_IMPLEMENTING_MATCH = %i[const regexp str sym].freeze
|
81
|
-
MSG = 'Use `match?` instead of `%<current>s` when `MatchData` '
|
82
|
-
'is not used.'
|
81
|
+
MSG = 'Use `match?` instead of `%<current>s` when `MatchData` is not used.'
|
83
82
|
|
84
83
|
def_node_matcher :match_method?, <<~PATTERN
|
85
84
|
{
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Performance
|
6
|
+
# In Ruby 2.7, `Enumerable#filter_map` has been added.
|
7
|
+
#
|
8
|
+
# This cop identifies places where `select.map` can be replaced by `filter_map`.
|
9
|
+
#
|
10
|
+
# @example
|
11
|
+
# # bad
|
12
|
+
# ary.select(&:foo).map(&:bar)
|
13
|
+
# ary.filter(&:foo).map(&:bar)
|
14
|
+
#
|
15
|
+
# # good
|
16
|
+
# ary.filter_map { |o| o.bar if o.foo }
|
17
|
+
#
|
18
|
+
class SelectMap < Base
|
19
|
+
include RangeHelp
|
20
|
+
extend TargetRubyVersion
|
21
|
+
|
22
|
+
minimum_target_ruby_version 2.7
|
23
|
+
|
24
|
+
MSG = 'Use `filter_map` instead of `%<method_name>s.map`.'
|
25
|
+
RESTRICT_ON_SEND = %i[select filter].freeze
|
26
|
+
|
27
|
+
def_node_matcher :bad_method?, <<~PATTERN
|
28
|
+
(send nil? :bad_method ...)
|
29
|
+
PATTERN
|
30
|
+
|
31
|
+
def on_send(node)
|
32
|
+
return if (first_argument = node.first_argument) && !first_argument.block_pass_type?
|
33
|
+
return unless (send_node = map_method_candidate(node))
|
34
|
+
return unless send_node.method?(:map)
|
35
|
+
|
36
|
+
map_method = send_node.parent&.block_type? ? send_node.parent : send_node
|
37
|
+
|
38
|
+
range = offense_range(node, map_method)
|
39
|
+
add_offense(range, message: format(MSG, method_name: node.method_name))
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def map_method_candidate(node)
|
45
|
+
return unless (parent = node.parent)
|
46
|
+
|
47
|
+
if parent.block_type? && parent.parent&.send_type?
|
48
|
+
parent.parent
|
49
|
+
elsif parent.send_type?
|
50
|
+
parent
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def offense_range(node, map_method)
|
55
|
+
range_between(node.loc.selector.begin_pos, map_method.loc.expression.end_pos)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -45,7 +45,10 @@ module RuboCop
|
|
45
45
|
return unless dup_string?(node) || string_new?(node)
|
46
46
|
|
47
47
|
add_offense(node) do |corrector|
|
48
|
-
|
48
|
+
string_value = "+#{string_value(node)}"
|
49
|
+
string_value = "(#{string_value})" if node.parent&.send_type?
|
50
|
+
|
51
|
+
corrector.replace(node, string_value)
|
49
52
|
end
|
50
53
|
end
|
51
54
|
|
@@ -23,6 +23,7 @@ require_relative 'performance/end_with'
|
|
23
23
|
require_relative 'performance/fixed_size'
|
24
24
|
require_relative 'performance/flat_map'
|
25
25
|
require_relative 'performance/inefficient_hash_search'
|
26
|
+
require_relative 'performance/map_compact'
|
26
27
|
require_relative 'performance/method_object_as_block'
|
27
28
|
require_relative 'performance/open_struct'
|
28
29
|
require_relative 'performance/range_include'
|
@@ -37,6 +38,7 @@ require_relative 'performance/redundant_string_chars'
|
|
37
38
|
require_relative 'performance/regexp_match'
|
38
39
|
require_relative 'performance/reverse_each'
|
39
40
|
require_relative 'performance/reverse_first'
|
41
|
+
require_relative 'performance/select_map'
|
40
42
|
require_relative 'performance/size'
|
41
43
|
require_relative 'performance/sort_reverse'
|
42
44
|
require_relative 'performance/squeeze'
|
data/lib/rubocop/performance.rb
CHANGED
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.
|
4
|
+
version: 1.11.4
|
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-07-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubocop
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 1.7.0
|
22
22
|
- - "<"
|
23
23
|
- !ruby/object:Gem::Version
|
24
24
|
version: '2.0'
|
@@ -28,7 +28,7 @@ dependencies:
|
|
28
28
|
requirements:
|
29
29
|
- - ">="
|
30
30
|
- !ruby/object:Gem::Version
|
31
|
-
version:
|
31
|
+
version: 1.7.0
|
32
32
|
- - "<"
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '2.0'
|
@@ -59,6 +59,7 @@ files:
|
|
59
59
|
- LICENSE.txt
|
60
60
|
- README.md
|
61
61
|
- config/default.yml
|
62
|
+
- config/obsoletion.yml
|
62
63
|
- lib/rubocop-performance.rb
|
63
64
|
- lib/rubocop/cop/mixin/regexp_metacharacter.rb
|
64
65
|
- lib/rubocop/cop/mixin/sort_block.rb
|
@@ -84,6 +85,7 @@ files:
|
|
84
85
|
- lib/rubocop/cop/performance/flat_map.rb
|
85
86
|
- lib/rubocop/cop/performance/inefficient_hash_search.rb
|
86
87
|
- lib/rubocop/cop/performance/io_readlines.rb
|
88
|
+
- lib/rubocop/cop/performance/map_compact.rb
|
87
89
|
- lib/rubocop/cop/performance/method_object_as_block.rb
|
88
90
|
- lib/rubocop/cop/performance/open_struct.rb
|
89
91
|
- lib/rubocop/cop/performance/range_include.rb
|
@@ -97,6 +99,7 @@ files:
|
|
97
99
|
- lib/rubocop/cop/performance/regexp_match.rb
|
98
100
|
- lib/rubocop/cop/performance/reverse_each.rb
|
99
101
|
- lib/rubocop/cop/performance/reverse_first.rb
|
102
|
+
- lib/rubocop/cop/performance/select_map.rb
|
100
103
|
- lib/rubocop/cop/performance/size.rb
|
101
104
|
- lib/rubocop/cop/performance/sort_reverse.rb
|
102
105
|
- lib/rubocop/cop/performance/squeeze.rb
|
@@ -118,7 +121,7 @@ metadata:
|
|
118
121
|
homepage_uri: https://docs.rubocop.org/rubocop-performance/
|
119
122
|
changelog_uri: https://github.com/rubocop/rubocop-performance/blob/master/CHANGELOG.md
|
120
123
|
source_code_uri: https://github.com/rubocop/rubocop-performance/
|
121
|
-
documentation_uri: https://docs.rubocop.org/rubocop-performance/1.
|
124
|
+
documentation_uri: https://docs.rubocop.org/rubocop-performance/1.11/
|
122
125
|
bug_tracker_uri: https://github.com/rubocop/rubocop-performance/issues
|
123
126
|
post_install_message:
|
124
127
|
rdoc_options: []
|
@@ -128,7 +131,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
128
131
|
requirements:
|
129
132
|
- - ">="
|
130
133
|
- !ruby/object:Gem::Version
|
131
|
-
version: 2.
|
134
|
+
version: 2.5.0
|
132
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
136
|
requirements:
|
134
137
|
- - ">="
|