rubocop-performance 1.5.2 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +5 -1
- data/config/default.yml +96 -13
- data/lib/rubocop/cop/mixin/regexp_metacharacter.rb +76 -0
- 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 +77 -0
- data/lib/rubocop/cop/performance/caller.rb +5 -4
- data/lib/rubocop/cop/performance/case_when_splat.rb +18 -11
- data/lib/rubocop/cop/performance/casecmp.rb +17 -23
- data/lib/rubocop/cop/performance/chain_array_allocation.rb +5 -11
- data/lib/rubocop/cop/performance/collection_literal_in_loop.rb +140 -0
- data/lib/rubocop/cop/performance/compare_with_block.rb +12 -23
- data/lib/rubocop/cop/performance/count.rb +14 -17
- data/lib/rubocop/cop/performance/delete_prefix.rb +87 -0
- data/lib/rubocop/cop/performance/delete_suffix.rb +87 -0
- data/lib/rubocop/cop/performance/detect.rb +64 -32
- data/lib/rubocop/cop/performance/double_start_end_with.rb +18 -26
- data/lib/rubocop/cop/performance/end_with.rb +38 -25
- data/lib/rubocop/cop/performance/fixed_size.rb +2 -2
- data/lib/rubocop/cop/performance/flat_map.rb +21 -23
- data/lib/rubocop/cop/performance/inefficient_hash_search.rb +14 -15
- data/lib/rubocop/cop/performance/io_readlines.rb +116 -0
- data/lib/rubocop/cop/performance/open_struct.rb +3 -3
- data/lib/rubocop/cop/performance/range_include.rb +15 -12
- data/lib/rubocop/cop/performance/redundant_block_call.rb +14 -9
- data/lib/rubocop/cop/performance/redundant_match.rb +13 -8
- data/lib/rubocop/cop/performance/redundant_merge.rb +36 -23
- 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 +32 -32
- data/lib/rubocop/cop/performance/reverse_each.rb +10 -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 +38 -28
- data/lib/rubocop/cop/performance/string_include.rb +55 -0
- data/lib/rubocop/cop/performance/string_replacement.rb +25 -36
- data/lib/rubocop/cop/performance/sum.rb +134 -0
- data/lib/rubocop/cop/performance/times_map.rb +12 -19
- data/lib/rubocop/cop/performance/unfreeze_string.rb +4 -8
- data/lib/rubocop/cop/performance/uri_default_parser.rb +7 -13
- data/lib/rubocop/cop/performance_cops.rb +17 -0
- data/lib/rubocop/performance/inject.rb +1 -1
- data/lib/rubocop/performance/version.rb +1 -1
- metadata +41 -11
@@ -18,17 +18,17 @@ 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
|
26
27
|
DELETE = 'delete'
|
27
28
|
TR = 'tr'
|
28
29
|
BANG = '!'
|
29
|
-
SINGLE_QUOTE = "'"
|
30
30
|
|
31
|
-
def_node_matcher :string_replacement?,
|
31
|
+
def_node_matcher :string_replacement?, <<~PATTERN
|
32
32
|
(send _ {:gsub :gsub!}
|
33
33
|
${regexp str (send (const nil? :Regexp) {:new :compile} _)}
|
34
34
|
$str)
|
@@ -43,37 +43,37 @@ module RuboCop
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
|
47
|
-
|
46
|
+
private
|
47
|
+
|
48
|
+
def offense(node, first_param, second_param)
|
48
49
|
first_source, = first_source(first_param)
|
50
|
+
first_source = interpret_string_escapes(first_source) unless first_param.str_type?
|
49
51
|
second_source, = *second_param
|
52
|
+
message = message(node, first_source, second_source)
|
50
53
|
|
51
|
-
|
52
|
-
|
54
|
+
add_offense(range(node), message: message) do |corrector|
|
55
|
+
autocorrect(corrector, node)
|
53
56
|
end
|
57
|
+
end
|
54
58
|
|
55
|
-
|
56
|
-
|
59
|
+
def autocorrect(corrector, node)
|
60
|
+
_string, _method, first_param, second_param = *node
|
61
|
+
first_source, = first_source(first_param)
|
62
|
+
second_source, = *second_param
|
57
63
|
|
58
|
-
|
59
|
-
replacement_method)
|
60
|
-
end
|
64
|
+
first_source = interpret_string_escapes(first_source) unless first_param.str_type?
|
61
65
|
|
62
|
-
|
63
|
-
lambda do |corrector|
|
64
|
-
corrector.replace(node.loc.selector, replacement)
|
65
|
-
unless first_param.str_type?
|
66
|
-
corrector.replace(first_param.source_range,
|
67
|
-
to_string_literal(first))
|
68
|
-
end
|
69
|
-
|
70
|
-
if second.empty? && first.length == 1
|
71
|
-
remove_second_param(corrector, node, first_param)
|
72
|
-
end
|
73
|
-
end
|
66
|
+
replace_method(corrector, node, first_source, second_source, first_param)
|
74
67
|
end
|
75
68
|
|
76
|
-
|
69
|
+
def replace_method(corrector, node, first_source, second_source, first_param)
|
70
|
+
replacement_method = replacement_method(node, first_source, second_source)
|
71
|
+
|
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?
|
74
|
+
|
75
|
+
remove_second_param(corrector, node, first_param) if second_source.empty? && first_source.length == 1
|
76
|
+
end
|
77
77
|
|
78
78
|
def accept_second_param?(second_param)
|
79
79
|
second_source, = *second_param
|
@@ -97,17 +97,6 @@ module RuboCop
|
|
97
97
|
first_source.length != 1
|
98
98
|
end
|
99
99
|
|
100
|
-
def offense(node, first_param, second_param)
|
101
|
-
first_source, = first_source(first_param)
|
102
|
-
unless first_param.str_type?
|
103
|
-
first_source = interpret_string_escapes(first_source)
|
104
|
-
end
|
105
|
-
second_source, = *second_param
|
106
|
-
message = message(node, first_source, second_source)
|
107
|
-
|
108
|
-
add_offense(node, location: range(node), message: message)
|
109
|
-
end
|
110
|
-
|
111
100
|
def first_source(first_param)
|
112
101
|
case first_param.type
|
113
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,38 +32,29 @@ 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
|
-
def_node_matcher :times_map_call,
|
57
|
+
def_node_matcher :times_map_call, <<~PATTERN
|
65
58
|
{(block $(send (send $!nil? :times) {:map :collect}) ...)
|
66
59
|
$(send (send $!nil? :times) {:map :collect} (block_pass ...))}
|
67
60
|
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,18 +23,14 @@ module RuboCop
|
|
23
23
|
# # good
|
24
24
|
# +'something'
|
25
25
|
# +''
|
26
|
-
class UnfreezeString <
|
27
|
-
extend TargetRubyVersion
|
28
|
-
|
29
|
-
minimum_target_ruby_version 2.3
|
30
|
-
|
26
|
+
class UnfreezeString < Base
|
31
27
|
MSG = 'Use unary plus to get an unfrozen string literal.'
|
32
28
|
|
33
|
-
def_node_matcher :dup_string?,
|
29
|
+
def_node_matcher :dup_string?, <<~PATTERN
|
34
30
|
(send {str dstr} :dup)
|
35
31
|
PATTERN
|
36
32
|
|
37
|
-
def_node_matcher :string_new?,
|
33
|
+
def_node_matcher :string_new?, <<~PATTERN
|
38
34
|
{
|
39
35
|
(send (const nil? :String) :new {str dstr})
|
40
36
|
(send (const nil? :String) :new)
|
@@ -13,11 +13,13 @@ 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
|
|
20
|
-
def_node_matcher :uri_parser_new?,
|
22
|
+
def_node_matcher :uri_parser_new?, <<~PATTERN
|
21
23
|
(send
|
22
24
|
(const
|
23
25
|
(const ${nil? cbase} :URI) :Parser) :new)
|
@@ -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,10 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'mixin/regexp_metacharacter'
|
4
|
+
require_relative 'mixin/sort_block'
|
5
|
+
|
6
|
+
require_relative 'performance/ancestors_include'
|
7
|
+
require_relative 'performance/big_decimal_with_numeric_argument'
|
8
|
+
require_relative 'performance/bind_call'
|
3
9
|
require_relative 'performance/caller'
|
4
10
|
require_relative 'performance/case_when_splat'
|
5
11
|
require_relative 'performance/casecmp'
|
12
|
+
require_relative 'performance/collection_literal_in_loop'
|
6
13
|
require_relative 'performance/compare_with_block'
|
7
14
|
require_relative 'performance/count'
|
15
|
+
require_relative 'performance/delete_prefix'
|
16
|
+
require_relative 'performance/delete_suffix'
|
8
17
|
require_relative 'performance/detect'
|
9
18
|
require_relative 'performance/double_start_end_with'
|
10
19
|
require_relative 'performance/end_with'
|
@@ -13,14 +22,22 @@ require_relative 'performance/flat_map'
|
|
13
22
|
require_relative 'performance/inefficient_hash_search'
|
14
23
|
require_relative 'performance/open_struct'
|
15
24
|
require_relative 'performance/range_include'
|
25
|
+
require_relative 'performance/io_readlines'
|
16
26
|
require_relative 'performance/redundant_block_call'
|
17
27
|
require_relative 'performance/redundant_match'
|
18
28
|
require_relative 'performance/redundant_merge'
|
29
|
+
require_relative 'performance/redundant_sort_block'
|
30
|
+
require_relative 'performance/redundant_string_chars'
|
19
31
|
require_relative 'performance/regexp_match'
|
20
32
|
require_relative 'performance/reverse_each'
|
33
|
+
require_relative 'performance/reverse_first'
|
21
34
|
require_relative 'performance/size'
|
35
|
+
require_relative 'performance/sort_reverse'
|
36
|
+
require_relative 'performance/squeeze'
|
22
37
|
require_relative 'performance/start_with'
|
38
|
+
require_relative 'performance/string_include'
|
23
39
|
require_relative 'performance/string_replacement'
|
40
|
+
require_relative 'performance/sum'
|
24
41
|
require_relative 'performance/times_map'
|
25
42
|
require_relative 'performance/unfreeze_string'
|
26
43
|
require_relative 'performance/uri_default_parser'
|
@@ -8,7 +8,7 @@ module RuboCop
|
|
8
8
|
def self.defaults!
|
9
9
|
path = CONFIG_DEFAULT.to_s
|
10
10
|
hash = ConfigLoader.send(:load_yaml_configuration, path)
|
11
|
-
config = Config.new(hash, path)
|
11
|
+
config = Config.new(hash, path).tap(&:make_excludes_absolute)
|
12
12
|
puts "configuration from #{path}" if ConfigLoader.debug?
|
13
13
|
config = ConfigLoader.merge_with_default(config, path)
|
14
14
|
ConfigLoader.instance_variable_set(:@default_configuration, config)
|
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:
|
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
|
@@ -40,9 +54,9 @@ dependencies:
|
|
40
54
|
- - ">="
|
41
55
|
- !ruby/object:Gem::Version
|
42
56
|
version: '0'
|
43
|
-
description: |
|
44
|
-
|
45
|
-
|
57
|
+
description: |
|
58
|
+
A collection of RuboCop cops to check for performance optimizations
|
59
|
+
in Ruby code.
|
46
60
|
email: rubocop@googlegroups.com
|
47
61
|
executables: []
|
48
62
|
extensions: []
|
@@ -54,28 +68,44 @@ files:
|
|
54
68
|
- README.md
|
55
69
|
- config/default.yml
|
56
70
|
- lib/rubocop-performance.rb
|
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
|
75
|
+
- lib/rubocop/cop/performance/bind_call.rb
|
57
76
|
- lib/rubocop/cop/performance/caller.rb
|
58
77
|
- lib/rubocop/cop/performance/case_when_splat.rb
|
59
78
|
- lib/rubocop/cop/performance/casecmp.rb
|
60
79
|
- lib/rubocop/cop/performance/chain_array_allocation.rb
|
80
|
+
- lib/rubocop/cop/performance/collection_literal_in_loop.rb
|
61
81
|
- lib/rubocop/cop/performance/compare_with_block.rb
|
62
82
|
- lib/rubocop/cop/performance/count.rb
|
83
|
+
- lib/rubocop/cop/performance/delete_prefix.rb
|
84
|
+
- lib/rubocop/cop/performance/delete_suffix.rb
|
63
85
|
- lib/rubocop/cop/performance/detect.rb
|
64
86
|
- lib/rubocop/cop/performance/double_start_end_with.rb
|
65
87
|
- lib/rubocop/cop/performance/end_with.rb
|
66
88
|
- lib/rubocop/cop/performance/fixed_size.rb
|
67
89
|
- lib/rubocop/cop/performance/flat_map.rb
|
68
90
|
- lib/rubocop/cop/performance/inefficient_hash_search.rb
|
91
|
+
- lib/rubocop/cop/performance/io_readlines.rb
|
69
92
|
- lib/rubocop/cop/performance/open_struct.rb
|
70
93
|
- lib/rubocop/cop/performance/range_include.rb
|
71
94
|
- lib/rubocop/cop/performance/redundant_block_call.rb
|
72
95
|
- lib/rubocop/cop/performance/redundant_match.rb
|
73
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
|
74
99
|
- lib/rubocop/cop/performance/regexp_match.rb
|
75
100
|
- lib/rubocop/cop/performance/reverse_each.rb
|
101
|
+
- lib/rubocop/cop/performance/reverse_first.rb
|
76
102
|
- lib/rubocop/cop/performance/size.rb
|
103
|
+
- lib/rubocop/cop/performance/sort_reverse.rb
|
104
|
+
- lib/rubocop/cop/performance/squeeze.rb
|
77
105
|
- lib/rubocop/cop/performance/start_with.rb
|
106
|
+
- lib/rubocop/cop/performance/string_include.rb
|
78
107
|
- lib/rubocop/cop/performance/string_replacement.rb
|
108
|
+
- lib/rubocop/cop/performance/sum.rb
|
79
109
|
- lib/rubocop/cop/performance/times_map.rb
|
80
110
|
- lib/rubocop/cop/performance/unfreeze_string.rb
|
81
111
|
- lib/rubocop/cop/performance/uri_default_parser.rb
|
@@ -87,10 +117,10 @@ homepage: https://github.com/rubocop-hq/rubocop-performance
|
|
87
117
|
licenses:
|
88
118
|
- MIT
|
89
119
|
metadata:
|
90
|
-
homepage_uri: https://docs.rubocop.org/
|
120
|
+
homepage_uri: https://docs.rubocop.org/rubocop-performance/
|
91
121
|
changelog_uri: https://github.com/rubocop-hq/rubocop-performance/blob/master/CHANGELOG.md
|
92
122
|
source_code_uri: https://github.com/rubocop-hq/rubocop-performance/
|
93
|
-
documentation_uri: https://docs.rubocop.org/
|
123
|
+
documentation_uri: https://docs.rubocop.org/rubocop-performance/
|
94
124
|
bug_tracker_uri: https://github.com/rubocop-hq/rubocop-performance/issues
|
95
125
|
post_install_message:
|
96
126
|
rdoc_options: []
|
@@ -100,14 +130,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
100
130
|
requirements:
|
101
131
|
- - ">="
|
102
132
|
- !ruby/object:Gem::Version
|
103
|
-
version: 2.
|
133
|
+
version: 2.4.0
|
104
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
135
|
requirements:
|
106
136
|
- - ">="
|
107
137
|
- !ruby/object:Gem::Version
|
108
138
|
version: '0'
|
109
139
|
requirements: []
|
110
|
-
rubygems_version: 3.1.
|
140
|
+
rubygems_version: 3.1.4
|
111
141
|
signing_key:
|
112
142
|
specification_version: 4
|
113
143
|
summary: Automatic performance checking tool for Ruby code.
|