rubocop-performance 1.6.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/README.md +1 -1
- data/config/default.yml +77 -10
- data/lib/rubocop/cop/mixin/regexp_metacharacter.rb +39 -4
- data/lib/rubocop/cop/mixin/sort_block.rb +28 -0
- data/lib/rubocop/cop/performance/ancestors_include.rb +48 -0
- data/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb +45 -0
- data/lib/rubocop/cop/performance/bind_call.rb +8 -18
- data/lib/rubocop/cop/performance/caller.rb +3 -2
- data/lib/rubocop/cop/performance/case_when_splat.rb +18 -11
- data/lib/rubocop/cop/performance/casecmp.rb +12 -20
- data/lib/rubocop/cop/performance/chain_array_allocation.rb +4 -10
- 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/count.rb +13 -16
- data/lib/rubocop/cop/performance/delete_prefix.rb +43 -28
- data/lib/rubocop/cop/performance/delete_suffix.rb +43 -28
- data/lib/rubocop/cop/performance/detect.rb +63 -31
- data/lib/rubocop/cop/performance/double_start_end_with.rb +16 -24
- data/lib/rubocop/cop/performance/end_with.rb +29 -17
- data/lib/rubocop/cop/performance/fixed_size.rb +1 -1
- data/lib/rubocop/cop/performance/flat_map.rb +20 -22
- data/lib/rubocop/cop/performance/inefficient_hash_search.rb +13 -14
- data/lib/rubocop/cop/performance/io_readlines.rb +116 -0
- data/lib/rubocop/cop/performance/open_struct.rb +2 -2
- data/lib/rubocop/cop/performance/range_include.rb +14 -11
- data/lib/rubocop/cop/performance/redundant_block_call.rb +11 -6
- data/lib/rubocop/cop/performance/redundant_match.rb +11 -6
- data/lib/rubocop/cop/performance/redundant_merge.rb +18 -17
- data/lib/rubocop/cop/performance/redundant_sort_block.rb +43 -0
- data/lib/rubocop/cop/performance/redundant_string_chars.rb +133 -0
- data/lib/rubocop/cop/performance/regexp_match.rb +20 -20
- data/lib/rubocop/cop/performance/reverse_each.rb +9 -5
- data/lib/rubocop/cop/performance/reverse_first.rb +72 -0
- data/lib/rubocop/cop/performance/size.rb +41 -43
- data/lib/rubocop/cop/performance/sort_reverse.rb +45 -0
- data/lib/rubocop/cop/performance/squeeze.rb +66 -0
- data/lib/rubocop/cop/performance/start_with.rb +29 -17
- data/lib/rubocop/cop/performance/string_include.rb +55 -0
- data/lib/rubocop/cop/performance/string_replacement.rb +23 -27
- data/lib/rubocop/cop/performance/sum.rb +134 -0
- data/lib/rubocop/cop/performance/times_map.rb +11 -18
- data/lib/rubocop/cop/performance/unfreeze_string.rb +2 -2
- data/lib/rubocop/cop/performance/uri_default_parser.rb +6 -12
- data/lib/rubocop/cop/performance_cops.rb +12 -0
- data/lib/rubocop/performance/version.rb +1 -1
- metadata +33 -8
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Performance
|
6
|
+
# This cop identifies unnecessary use of a regex where
|
7
|
+
# `String#include?` would suffice.
|
8
|
+
#
|
9
|
+
# This cop's offenses are not safe to auto-correct if a receiver is nil.
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# # bad
|
13
|
+
# 'abc'.match?(/ab/)
|
14
|
+
# /ab/.match?('abc')
|
15
|
+
# 'abc' =~ /ab/
|
16
|
+
# /ab/ =~ 'abc'
|
17
|
+
# 'abc'.match(/ab/)
|
18
|
+
# /ab/.match('abc')
|
19
|
+
#
|
20
|
+
# # good
|
21
|
+
# 'abc'.include?('ab')
|
22
|
+
class StringInclude < Base
|
23
|
+
extend AutoCorrector
|
24
|
+
|
25
|
+
MSG = 'Use `String#include?` instead of a regex match with literal-only pattern.'
|
26
|
+
|
27
|
+
def_node_matcher :redundant_regex?, <<~PATTERN
|
28
|
+
{(send $!nil? {:match :=~ :match?} (regexp (str $#literal?) (regopt)))
|
29
|
+
(send (regexp (str $#literal?) (regopt)) {:match :match?} $str)
|
30
|
+
(match-with-lvasgn (regexp (str $#literal?) (regopt)) $_)}
|
31
|
+
PATTERN
|
32
|
+
|
33
|
+
def on_send(node)
|
34
|
+
return unless (receiver, regex_str = redundant_regex?(node))
|
35
|
+
|
36
|
+
add_offense(node) do |corrector|
|
37
|
+
receiver, regex_str = regex_str, receiver if receiver.is_a?(String)
|
38
|
+
regex_str = interpret_string_escapes(regex_str)
|
39
|
+
|
40
|
+
new_source = "#{receiver.source}.include?(#{to_string_literal(regex_str)})"
|
41
|
+
|
42
|
+
corrector.replace(node.source_range, new_source)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
alias on_match_with_lvasgn on_send
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def literal?(regex_str)
|
50
|
+
regex_str.match?(/\A#{Util::LITERAL_REGEX}+\z/)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -18,8 +18,9 @@ module RuboCop
|
|
18
18
|
# 'abc'.gsub(/a+/, 'd')
|
19
19
|
# 'abc'.tr('b', 'd')
|
20
20
|
# 'a b c'.delete(' ')
|
21
|
-
class StringReplacement <
|
21
|
+
class StringReplacement < Base
|
22
22
|
include RangeHelp
|
23
|
+
extend AutoCorrector
|
23
24
|
|
24
25
|
MSG = 'Use `%<prefer>s` instead of `%<current>s`.'
|
25
26
|
DETERMINISTIC_REGEX = /\A(?:#{LITERAL_REGEX})+\Z/.freeze
|
@@ -42,33 +43,37 @@ module RuboCop
|
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
45
|
-
|
46
|
+
private
|
47
|
+
|
48
|
+
def offense(node, first_param, second_param)
|
49
|
+
first_source, = first_source(first_param)
|
50
|
+
first_source = interpret_string_escapes(first_source) unless first_param.str_type?
|
51
|
+
second_source, = *second_param
|
52
|
+
message = message(node, first_source, second_source)
|
53
|
+
|
54
|
+
add_offense(range(node), message: message) do |corrector|
|
55
|
+
autocorrect(corrector, node)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def autocorrect(corrector, node)
|
46
60
|
_string, _method, first_param, second_param = *node
|
47
61
|
first_source, = first_source(first_param)
|
48
62
|
second_source, = *second_param
|
49
63
|
|
50
64
|
first_source = interpret_string_escapes(first_source) unless first_param.str_type?
|
51
65
|
|
52
|
-
|
53
|
-
replacement_method(node, first_source, second_source)
|
54
|
-
|
55
|
-
replace_method(node, first_source, second_source, first_param,
|
56
|
-
replacement_method)
|
66
|
+
replace_method(corrector, node, first_source, second_source, first_param)
|
57
67
|
end
|
58
68
|
|
59
|
-
def replace_method(node,
|
60
|
-
|
61
|
-
corrector.replace(node.loc.selector, replacement)
|
62
|
-
unless first_param.str_type?
|
63
|
-
corrector.replace(first_param.source_range,
|
64
|
-
to_string_literal(first))
|
65
|
-
end
|
69
|
+
def replace_method(corrector, node, first_source, second_source, first_param)
|
70
|
+
replacement_method = replacement_method(node, first_source, second_source)
|
66
71
|
|
67
|
-
|
68
|
-
|
69
|
-
end
|
72
|
+
corrector.replace(node.loc.selector, replacement_method)
|
73
|
+
corrector.replace(first_param.source_range, to_string_literal(first_source)) unless first_param.str_type?
|
70
74
|
|
71
|
-
|
75
|
+
remove_second_param(corrector, node, first_param) if second_source.empty? && first_source.length == 1
|
76
|
+
end
|
72
77
|
|
73
78
|
def accept_second_param?(second_param)
|
74
79
|
second_source, = *second_param
|
@@ -92,15 +97,6 @@ module RuboCop
|
|
92
97
|
first_source.length != 1
|
93
98
|
end
|
94
99
|
|
95
|
-
def offense(node, first_param, second_param)
|
96
|
-
first_source, = first_source(first_param)
|
97
|
-
first_source = interpret_string_escapes(first_source) unless first_param.str_type?
|
98
|
-
second_source, = *second_param
|
99
|
-
message = message(node, first_source, second_source)
|
100
|
-
|
101
|
-
add_offense(node, location: range(node), message: message)
|
102
|
-
end
|
103
|
-
|
104
100
|
def first_source(first_param)
|
105
101
|
case first_param.type
|
106
102
|
when :regexp
|
@@ -0,0 +1,134 @@
|
|
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
|
+
# @example
|
10
|
+
# # bad
|
11
|
+
# [1, 2, 3].inject(:+)
|
12
|
+
# [1, 2, 3].reduce(10, :+)
|
13
|
+
# [1, 2, 3].inject(&:+)
|
14
|
+
# [1, 2, 3].reduce { |acc, elem| acc + elem }
|
15
|
+
#
|
16
|
+
# # good
|
17
|
+
# [1, 2, 3].sum
|
18
|
+
# [1, 2, 3].sum(10)
|
19
|
+
# [1, 2, 3].sum
|
20
|
+
#
|
21
|
+
class Sum < Base
|
22
|
+
include RangeHelp
|
23
|
+
extend AutoCorrector
|
24
|
+
|
25
|
+
MSG = 'Use `%<good_method>s` instead of `%<bad_method>s`.'
|
26
|
+
|
27
|
+
def_node_matcher :sum_candidate?, <<~PATTERN
|
28
|
+
(send _ ${:inject :reduce} $_init ? ${(sym :+) (block_pass (sym :+))})
|
29
|
+
PATTERN
|
30
|
+
|
31
|
+
def_node_matcher :sum_with_block_candidate?, <<~PATTERN
|
32
|
+
(block
|
33
|
+
$(send _ {:inject :reduce} $_init ?)
|
34
|
+
(args (arg $_acc) (arg $_elem))
|
35
|
+
$send)
|
36
|
+
PATTERN
|
37
|
+
|
38
|
+
def_node_matcher :acc_plus_elem?, <<~PATTERN
|
39
|
+
(send (lvar %1) :+ (lvar %2))
|
40
|
+
PATTERN
|
41
|
+
alias elem_plus_acc? acc_plus_elem?
|
42
|
+
|
43
|
+
def on_send(node)
|
44
|
+
sum_candidate?(node) do |method, init, operation|
|
45
|
+
range = sum_method_range(node)
|
46
|
+
message = build_method_message(method, init, operation)
|
47
|
+
|
48
|
+
add_offense(range, message: message) do |corrector|
|
49
|
+
autocorrect(corrector, init, range)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def on_block(node)
|
55
|
+
sum_with_block_candidate?(node) do |send, init, var_acc, var_elem, body|
|
56
|
+
if acc_plus_elem?(body, var_acc, var_elem) || elem_plus_acc?(body, var_elem, var_acc)
|
57
|
+
range = sum_block_range(send, node)
|
58
|
+
message = build_block_message(send, init, var_acc, var_elem, body)
|
59
|
+
|
60
|
+
add_offense(range, message: message) do |corrector|
|
61
|
+
autocorrect(corrector, init, range)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
def autocorrect(corrector, init, range)
|
70
|
+
return if init.empty?
|
71
|
+
|
72
|
+
replacement = build_good_method(init)
|
73
|
+
|
74
|
+
corrector.replace(range, replacement)
|
75
|
+
end
|
76
|
+
|
77
|
+
def sum_method_range(node)
|
78
|
+
range_between(node.loc.selector.begin_pos, node.loc.end.end_pos)
|
79
|
+
end
|
80
|
+
|
81
|
+
def sum_block_range(send, node)
|
82
|
+
range_between(send.loc.selector.begin_pos, node.loc.end.end_pos)
|
83
|
+
end
|
84
|
+
|
85
|
+
def build_method_message(method, init, operation)
|
86
|
+
good_method = build_good_method(init)
|
87
|
+
bad_method = build_method_bad_method(init, method, operation)
|
88
|
+
format(MSG, good_method: good_method, bad_method: bad_method)
|
89
|
+
end
|
90
|
+
|
91
|
+
def build_block_message(send, init, var_acc, var_elem, body)
|
92
|
+
good_method = build_good_method(init)
|
93
|
+
bad_method = build_block_bad_method(send.method_name, init, var_acc, var_elem, body)
|
94
|
+
format(MSG, good_method: good_method, bad_method: bad_method)
|
95
|
+
end
|
96
|
+
|
97
|
+
def build_good_method(init)
|
98
|
+
good_method = 'sum'
|
99
|
+
|
100
|
+
unless init.empty?
|
101
|
+
init = init.first
|
102
|
+
good_method += "(#{init.source})" unless init.int_type? && init.value.zero?
|
103
|
+
end
|
104
|
+
good_method
|
105
|
+
end
|
106
|
+
|
107
|
+
def build_method_bad_method(init, method, operation)
|
108
|
+
bad_method = "#{method}("
|
109
|
+
unless init.empty?
|
110
|
+
init = init.first
|
111
|
+
bad_method += "#{init.source}, "
|
112
|
+
end
|
113
|
+
bad_method += if operation.block_pass_type?
|
114
|
+
'&:+)'
|
115
|
+
else
|
116
|
+
':+)'
|
117
|
+
end
|
118
|
+
bad_method
|
119
|
+
end
|
120
|
+
|
121
|
+
def build_block_bad_method(method, init, var_acc, var_elem, body)
|
122
|
+
bad_method = method.to_s
|
123
|
+
|
124
|
+
unless init.empty?
|
125
|
+
init = init.first
|
126
|
+
bad_method += "(#{init.source})"
|
127
|
+
end
|
128
|
+
bad_method += " { |#{var_acc}, #{var_elem}| #{body.source} }"
|
129
|
+
bad_method
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
@@ -17,7 +17,9 @@ 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'
|
@@ -30,35 +32,26 @@ module RuboCop
|
|
30
32
|
check(node)
|
31
33
|
end
|
32
34
|
|
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
35
|
private
|
46
36
|
|
47
37
|
def check(node)
|
48
38
|
times_map_call(node) do |map_or_collect, count|
|
49
|
-
add_offense(node, message: message(map_or_collect, count))
|
39
|
+
add_offense(node, message: message(map_or_collect, count)) do |corrector|
|
40
|
+
replacement = "Array.new(#{count.source}" \
|
41
|
+
"#{map_or_collect.arguments.map { |arg| ", #{arg.source}" }.join})"
|
42
|
+
|
43
|
+
corrector.replace(map_or_collect.loc.expression, replacement)
|
44
|
+
end
|
50
45
|
end
|
51
46
|
end
|
52
47
|
|
53
48
|
def message(map_or_collect, count)
|
54
49
|
template = if count.literal?
|
55
|
-
MESSAGE
|
50
|
+
"#{MESSAGE}."
|
56
51
|
else
|
57
52
|
"#{MESSAGE} #{MESSAGE_ONLY_IF}."
|
58
53
|
end
|
59
|
-
format(template,
|
60
|
-
count: count.source,
|
61
|
-
map_or_collect: map_or_collect.method_name)
|
54
|
+
format(template, count: count.source, map_or_collect: map_or_collect.method_name)
|
62
55
|
end
|
63
56
|
|
64
57
|
def_node_matcher :times_map_call, <<~PATTERN
|
@@ -7,7 +7,7 @@ module RuboCop
|
|
7
7
|
# literal instead of `String#dup` and `String.new`.
|
8
8
|
# Unary plus operator is faster than `String#dup`.
|
9
9
|
#
|
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
13
|
# So, if you expect `ASCII-8BIT` encoding, disable this cop.
|
@@ -23,7 +23,7 @@ module RuboCop
|
|
23
23
|
# # good
|
24
24
|
# +'something'
|
25
25
|
# +''
|
26
|
-
class UnfreezeString <
|
26
|
+
class UnfreezeString < Base
|
27
27
|
MSG = 'Use unary plus to get an unfrozen string literal.'
|
28
28
|
|
29
29
|
def_node_matcher :dup_string?, <<~PATTERN
|
@@ -13,7 +13,9 @@ 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`.'
|
19
21
|
|
@@ -28,17 +30,9 @@ module RuboCop
|
|
28
30
|
double_colon = captured_value ? '::' : ''
|
29
31
|
message = format(MSG, double_colon: double_colon)
|
30
32
|
|
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
|
-
)
|
33
|
+
add_offense(node, message: message) do |corrector|
|
34
|
+
corrector.replace(node.loc.expression, "#{double_colon}URI::DEFAULT_PARSER")
|
35
|
+
end
|
42
36
|
end
|
43
37
|
end
|
44
38
|
end
|
@@ -1,11 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'mixin/regexp_metacharacter'
|
4
|
+
require_relative 'mixin/sort_block'
|
4
5
|
|
6
|
+
require_relative 'performance/ancestors_include'
|
7
|
+
require_relative 'performance/big_decimal_with_numeric_argument'
|
5
8
|
require_relative 'performance/bind_call'
|
6
9
|
require_relative 'performance/caller'
|
7
10
|
require_relative 'performance/case_when_splat'
|
8
11
|
require_relative 'performance/casecmp'
|
12
|
+
require_relative 'performance/collection_literal_in_loop'
|
9
13
|
require_relative 'performance/compare_with_block'
|
10
14
|
require_relative 'performance/count'
|
11
15
|
require_relative 'performance/delete_prefix'
|
@@ -18,14 +22,22 @@ require_relative 'performance/flat_map'
|
|
18
22
|
require_relative 'performance/inefficient_hash_search'
|
19
23
|
require_relative 'performance/open_struct'
|
20
24
|
require_relative 'performance/range_include'
|
25
|
+
require_relative 'performance/io_readlines'
|
21
26
|
require_relative 'performance/redundant_block_call'
|
22
27
|
require_relative 'performance/redundant_match'
|
23
28
|
require_relative 'performance/redundant_merge'
|
29
|
+
require_relative 'performance/redundant_sort_block'
|
30
|
+
require_relative 'performance/redundant_string_chars'
|
24
31
|
require_relative 'performance/regexp_match'
|
25
32
|
require_relative 'performance/reverse_each'
|
33
|
+
require_relative 'performance/reverse_first'
|
26
34
|
require_relative 'performance/size'
|
35
|
+
require_relative 'performance/sort_reverse'
|
36
|
+
require_relative 'performance/squeeze'
|
27
37
|
require_relative 'performance/start_with'
|
38
|
+
require_relative 'performance/string_include'
|
28
39
|
require_relative 'performance/string_replacement'
|
40
|
+
require_relative 'performance/sum'
|
29
41
|
require_relative 'performance/times_map'
|
30
42
|
require_relative 'performance/unfreeze_string'
|
31
43
|
require_relative 'performance/uri_default_parser'
|
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.8.1
|
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: 2020-
|
13
|
+
date: 2020-09-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubocop
|
@@ -18,14 +18,28 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.87.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 0.
|
28
|
+
version: 0.87.0
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: rubocop-ast
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 0.4.0
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 0.4.0
|
29
43
|
- !ruby/object:Gem::Dependency
|
30
44
|
name: simplecov
|
31
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -55,11 +69,15 @@ files:
|
|
55
69
|
- config/default.yml
|
56
70
|
- lib/rubocop-performance.rb
|
57
71
|
- lib/rubocop/cop/mixin/regexp_metacharacter.rb
|
72
|
+
- lib/rubocop/cop/mixin/sort_block.rb
|
73
|
+
- lib/rubocop/cop/performance/ancestors_include.rb
|
74
|
+
- lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb
|
58
75
|
- lib/rubocop/cop/performance/bind_call.rb
|
59
76
|
- lib/rubocop/cop/performance/caller.rb
|
60
77
|
- lib/rubocop/cop/performance/case_when_splat.rb
|
61
78
|
- lib/rubocop/cop/performance/casecmp.rb
|
62
79
|
- lib/rubocop/cop/performance/chain_array_allocation.rb
|
80
|
+
- lib/rubocop/cop/performance/collection_literal_in_loop.rb
|
63
81
|
- lib/rubocop/cop/performance/compare_with_block.rb
|
64
82
|
- lib/rubocop/cop/performance/count.rb
|
65
83
|
- lib/rubocop/cop/performance/delete_prefix.rb
|
@@ -70,16 +88,24 @@ files:
|
|
70
88
|
- lib/rubocop/cop/performance/fixed_size.rb
|
71
89
|
- lib/rubocop/cop/performance/flat_map.rb
|
72
90
|
- lib/rubocop/cop/performance/inefficient_hash_search.rb
|
91
|
+
- lib/rubocop/cop/performance/io_readlines.rb
|
73
92
|
- lib/rubocop/cop/performance/open_struct.rb
|
74
93
|
- lib/rubocop/cop/performance/range_include.rb
|
75
94
|
- lib/rubocop/cop/performance/redundant_block_call.rb
|
76
95
|
- lib/rubocop/cop/performance/redundant_match.rb
|
77
96
|
- lib/rubocop/cop/performance/redundant_merge.rb
|
97
|
+
- lib/rubocop/cop/performance/redundant_sort_block.rb
|
98
|
+
- lib/rubocop/cop/performance/redundant_string_chars.rb
|
78
99
|
- lib/rubocop/cop/performance/regexp_match.rb
|
79
100
|
- lib/rubocop/cop/performance/reverse_each.rb
|
101
|
+
- lib/rubocop/cop/performance/reverse_first.rb
|
80
102
|
- lib/rubocop/cop/performance/size.rb
|
103
|
+
- lib/rubocop/cop/performance/sort_reverse.rb
|
104
|
+
- lib/rubocop/cop/performance/squeeze.rb
|
81
105
|
- lib/rubocop/cop/performance/start_with.rb
|
106
|
+
- lib/rubocop/cop/performance/string_include.rb
|
82
107
|
- lib/rubocop/cop/performance/string_replacement.rb
|
108
|
+
- lib/rubocop/cop/performance/sum.rb
|
83
109
|
- lib/rubocop/cop/performance/times_map.rb
|
84
110
|
- lib/rubocop/cop/performance/unfreeze_string.rb
|
85
111
|
- lib/rubocop/cop/performance/uri_default_parser.rb
|
@@ -91,10 +117,10 @@ homepage: https://github.com/rubocop-hq/rubocop-performance
|
|
91
117
|
licenses:
|
92
118
|
- MIT
|
93
119
|
metadata:
|
94
|
-
homepage_uri: https://docs.rubocop.org/
|
120
|
+
homepage_uri: https://docs.rubocop.org/rubocop-performance/
|
95
121
|
changelog_uri: https://github.com/rubocop-hq/rubocop-performance/blob/master/CHANGELOG.md
|
96
122
|
source_code_uri: https://github.com/rubocop-hq/rubocop-performance/
|
97
|
-
documentation_uri: https://docs.rubocop.org/
|
123
|
+
documentation_uri: https://docs.rubocop.org/rubocop-performance/
|
98
124
|
bug_tracker_uri: https://github.com/rubocop-hq/rubocop-performance/issues
|
99
125
|
post_install_message:
|
100
126
|
rdoc_options: []
|
@@ -111,8 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
137
|
- !ruby/object:Gem::Version
|
112
138
|
version: '0'
|
113
139
|
requirements: []
|
114
|
-
|
115
|
-
rubygems_version: 2.6.14.4
|
140
|
+
rubygems_version: 3.1.4
|
116
141
|
signing_key:
|
117
142
|
specification_version: 4
|
118
143
|
summary: Automatic performance checking tool for Ruby code.
|