rubocop-performance 1.26.0 → 1.27.0
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 +4 -4
- data/LICENSE.txt +1 -1
- data/config/default.yml +2 -1
- data/lib/rubocop/cop/mixin.rb +10 -0
- data/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb +1 -1
- data/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb +6 -2
- data/lib/rubocop/cop/performance/chain_array_allocation.rb +3 -3
- data/lib/rubocop/cop/performance/collection_literal_in_loop.rb +1 -2
- data/lib/rubocop/cop/performance/compare_with_block.rb +1 -2
- data/lib/rubocop/cop/performance/delete_prefix.rb +1 -2
- data/lib/rubocop/cop/performance/delete_suffix.rb +1 -2
- data/lib/rubocop/cop/performance/map_compact.rb +1 -1
- data/lib/rubocop/cop/performance/map_method_chain.rb +1 -2
- data/lib/rubocop/cop/performance/redundant_sort_block.rb +1 -0
- data/lib/rubocop/cop/performance/redundant_string_chars.rb +1 -0
- data/lib/rubocop/cop/performance/regexp_match.rb +4 -2
- data/lib/rubocop/cop/performance/sort_reverse.rb +1 -0
- data/lib/rubocop/cop/performance/squeeze.rb +1 -2
- data/lib/rubocop/cop/performance/string_include.rb +1 -2
- data/lib/rubocop/cop/performance.rb +66 -0
- data/lib/rubocop/cop/performance_cops.rb +4 -55
- data/lib/rubocop/performance/version.rb +1 -1
- data/lib/rubocop-performance.rb +1 -1
- metadata +9 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6494a135c3883af7e141b3dac6baf9e70f6e3d4389c0bb4970110b09693d979a
|
|
4
|
+
data.tar.gz: 46f88529d27b31e92492bd9d12ea117771a8c8adedcf275db9e19e91d3b58839
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fea19be56b1332f4485a443296aaa1e3e3bf32d335aa7490019de1f564edfdf50521a811df5d3856801e6258eb9b24e8d3b930786c4f3af5c20fc4a4449b82a5
|
|
7
|
+
data.tar.gz: 41ae92842e1372e7c546d837759cc60489ca11df8889384a010580ce4ce4666cf1546e19f1c7b2ab275017d88c406d25dbe2d61cb5edf614201398e0f2a7d1cf
|
data/LICENSE.txt
CHANGED
data/config/default.yml
CHANGED
|
@@ -22,8 +22,9 @@ Performance/ArraySemiInfiniteRangeSlice:
|
|
|
22
22
|
|
|
23
23
|
Performance/BigDecimalWithNumericArgument:
|
|
24
24
|
Description: 'Convert numeric literal to string and pass it to `BigDecimal`.'
|
|
25
|
-
Enabled:
|
|
25
|
+
Enabled: false
|
|
26
26
|
VersionAdded: '1.7'
|
|
27
|
+
VersionChanged: '1.26'
|
|
27
28
|
|
|
28
29
|
Performance/BindCall:
|
|
29
30
|
Description: 'Use `bind_call(obj, args, ...)` instead of `bind(obj).call(args, ...)`.'
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RuboCop
|
|
4
|
+
module Cop
|
|
5
|
+
# Autoloads mixin modules included by cops. Mixins are autoloaded to reduce the number of requires
|
|
6
|
+
# because they're used only when the relevant cop class is loaded.
|
|
7
|
+
autoload :RegexpMetacharacter, "#{__dir__}/mixin/regexp_metacharacter"
|
|
8
|
+
autoload :SortBlock, "#{__dir__}/mixin/sort_block"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -39,7 +39,7 @@ module RuboCop
|
|
|
39
39
|
RESTRICT_ON_SEND = SLICE_METHODS
|
|
40
40
|
|
|
41
41
|
def_node_matcher :endless_range_slice?, <<~PATTERN
|
|
42
|
-
(call $!
|
|
42
|
+
(call $!any_str $%SLICE_METHODS $#endless_range?)
|
|
43
43
|
PATTERN
|
|
44
44
|
|
|
45
45
|
def_node_matcher :endless_range?, <<~PATTERN
|
|
@@ -9,6 +9,11 @@ module RuboCop
|
|
|
9
9
|
# Also identifies places where an integer string argument to BigDecimal should be converted to
|
|
10
10
|
# an integer. Initializing from Integer is faster than from String for BigDecimal.
|
|
11
11
|
#
|
|
12
|
+
# NOTE: This cop is disabled by default because the performance of initializing with a String
|
|
13
|
+
# and Number differ between versions. Additionally, performance depends on the size of the Number,
|
|
14
|
+
# and if it is an Integer or a Float. Since this is very specific to `bigdecimal` internals,
|
|
15
|
+
# suggestions from this cop are not unlikely to result in code that performs worse than before.
|
|
16
|
+
#
|
|
12
17
|
# @example
|
|
13
18
|
# # bad
|
|
14
19
|
# BigDecimal(1.2, 3, exception: true)
|
|
@@ -44,7 +49,7 @@ module RuboCop
|
|
|
44
49
|
(send [!nil? ${float_type? str_type?}] :to_d ...)
|
|
45
50
|
PATTERN
|
|
46
51
|
|
|
47
|
-
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength
|
|
52
|
+
# rubocop:disable-next Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength
|
|
48
53
|
def on_send(node)
|
|
49
54
|
if (numeric = big_decimal_with_numeric_argument(node))
|
|
50
55
|
if numeric.numeric_type?
|
|
@@ -70,7 +75,6 @@ module RuboCop
|
|
|
70
75
|
end
|
|
71
76
|
end
|
|
72
77
|
end
|
|
73
|
-
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength
|
|
74
78
|
end
|
|
75
79
|
end
|
|
76
80
|
end
|
|
@@ -32,9 +32,9 @@ module RuboCop
|
|
|
32
32
|
|
|
33
33
|
# These methods ALWAYS return a new array
|
|
34
34
|
# after they're called it's safe to mutate the resulting array
|
|
35
|
-
ALWAYS_RETURNS_NEW_ARRAY = %i[* + - collect compact drop
|
|
36
|
-
drop_while flatten map
|
|
37
|
-
reverse rotate select shuffle sort
|
|
35
|
+
ALWAYS_RETURNS_NEW_ARRAY = %i[* + - collect collect_concat compact drop
|
|
36
|
+
drop_while filter_map flat_map flatten map
|
|
37
|
+
reject reverse rotate select shuffle sort
|
|
38
38
|
take take_while transpose uniq
|
|
39
39
|
values_at |].to_set.freeze
|
|
40
40
|
|
|
@@ -109,7 +109,7 @@ module RuboCop
|
|
|
109
109
|
|
|
110
110
|
# Since Ruby 3.4, simple arguments to Array#include? are optimized.
|
|
111
111
|
# See https://github.com/ruby/ruby/pull/12123 for more details.
|
|
112
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
|
112
|
+
# rubocop:disable-next Metrics/CyclomaticComplexity
|
|
113
113
|
def optimized_array_include?(node, method, arguments)
|
|
114
114
|
return false unless target_ruby_version >= 3.4 && node.array_type? && method == :include?
|
|
115
115
|
# Disallow include?(1, 2)
|
|
@@ -125,7 +125,6 @@ module RuboCop
|
|
|
125
125
|
end
|
|
126
126
|
ARRAY_INCLUDE_OPTIMIZED_TYPES.include?(arg.type)
|
|
127
127
|
end
|
|
128
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
|
129
128
|
|
|
130
129
|
def nonmutable_method_of_array_or_hash?(node, method)
|
|
131
130
|
(node.array_type? && ARRAY_METHODS.include?(method)) ||
|
|
@@ -87,7 +87,7 @@ module RuboCop
|
|
|
87
87
|
true
|
|
88
88
|
end
|
|
89
89
|
|
|
90
|
-
# rubocop:disable Metrics/MethodLength
|
|
90
|
+
# rubocop:disable-next Metrics/MethodLength
|
|
91
91
|
def message(send, method, var_a, var_b, args)
|
|
92
92
|
compare_method = send.method_name
|
|
93
93
|
replacement_method = REPLACEMENT[compare_method]
|
|
@@ -109,7 +109,6 @@ module RuboCop
|
|
|
109
109
|
str_a: str_a,
|
|
110
110
|
str_b: str_b)
|
|
111
111
|
end
|
|
112
|
-
# rubocop:enable Metrics/MethodLength
|
|
113
112
|
|
|
114
113
|
def compare_range(send, node)
|
|
115
114
|
range_between(send.loc.selector.begin_pos, node.loc.end.end_pos)
|
|
@@ -67,7 +67,7 @@ module RuboCop
|
|
|
67
67
|
(call $!nil? ${:gsub :gsub! :sub :sub!} (regexp (str $#literal_at_start?) (regopt)) (str $_))
|
|
68
68
|
PATTERN
|
|
69
69
|
|
|
70
|
-
# rubocop:disable Metrics/AbcSize
|
|
70
|
+
# rubocop:disable-next Metrics/AbcSize
|
|
71
71
|
def on_send(node)
|
|
72
72
|
return unless (receiver, bad_method, regexp_str, replace_string = delete_prefix_candidate?(node))
|
|
73
73
|
return unless replace_string.empty?
|
|
@@ -86,7 +86,6 @@ module RuboCop
|
|
|
86
86
|
corrector.replace(node, new_code)
|
|
87
87
|
end
|
|
88
88
|
end
|
|
89
|
-
# rubocop:enable Metrics/AbcSize
|
|
90
89
|
alias on_csend on_send
|
|
91
90
|
end
|
|
92
91
|
end
|
|
@@ -67,7 +67,7 @@ module RuboCop
|
|
|
67
67
|
(call $!nil? ${:gsub :gsub! :sub :sub!} (regexp (str $#literal_at_end?) (regopt)) (str $_))
|
|
68
68
|
PATTERN
|
|
69
69
|
|
|
70
|
-
# rubocop:disable Metrics/AbcSize
|
|
70
|
+
# rubocop:disable-next Metrics/AbcSize
|
|
71
71
|
def on_send(node)
|
|
72
72
|
return unless (receiver, bad_method, regexp_str, replace_string = delete_suffix_candidate?(node))
|
|
73
73
|
return unless replace_string.empty?
|
|
@@ -86,7 +86,6 @@ module RuboCop
|
|
|
86
86
|
corrector.replace(node, new_code)
|
|
87
87
|
end
|
|
88
88
|
end
|
|
89
|
-
# rubocop:enable Metrics/AbcSize
|
|
90
89
|
alias on_csend on_send
|
|
91
90
|
end
|
|
92
91
|
end
|
|
@@ -69,7 +69,7 @@ module RuboCop
|
|
|
69
69
|
def remove_compact_method(corrector, map_node, compact_node, chained_method)
|
|
70
70
|
compact_method_range = compact_node.loc.selector
|
|
71
71
|
|
|
72
|
-
if compact_node.multiline? && chained_method&.loc
|
|
72
|
+
if compact_node.multiline? && chained_method&.loc?(:selector) && use_dot?(chained_method) &&
|
|
73
73
|
!map_method_and_compact_method_on_same_line?(map_node, compact_node) &&
|
|
74
74
|
!invoke_method_after_map_compact_on_same_line?(compact_node, chained_method)
|
|
75
75
|
compact_method_range = compact_method_with_final_newline_range(compact_method_range)
|
|
@@ -68,7 +68,7 @@ module RuboCop
|
|
|
68
68
|
|
|
69
69
|
private
|
|
70
70
|
|
|
71
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
|
71
|
+
# rubocop:disable-next Metrics/CyclomaticComplexity
|
|
72
72
|
def find_begin_of_chained_map_method(node, map_args)
|
|
73
73
|
return unless (chained_map_method = node.receiver)
|
|
74
74
|
return if !chained_map_method.call_type? || !RESTRICT_ON_SEND.include?(chained_map_method.method_name)
|
|
@@ -82,7 +82,6 @@ module RuboCop
|
|
|
82
82
|
|
|
83
83
|
find_begin_of_chained_map_method(chained_map_method, map_args)
|
|
84
84
|
end
|
|
85
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
|
86
85
|
end
|
|
87
86
|
end
|
|
88
87
|
end
|
|
@@ -54,6 +54,7 @@ module RuboCop
|
|
|
54
54
|
def on_send(node)
|
|
55
55
|
return unless (receiver, method, args = redundant_chars_call?(node))
|
|
56
56
|
return if method == :last && !args.empty?
|
|
57
|
+
return if args.count == 2
|
|
57
58
|
|
|
58
59
|
range = offense_range(receiver, node)
|
|
59
60
|
message = build_message(method, args)
|
|
@@ -81,7 +81,7 @@ module RuboCop
|
|
|
81
81
|
# Constants are included in this list because it is unlikely that
|
|
82
82
|
# someone will store `nil` as a constant and then use it for comparison
|
|
83
83
|
TYPES_IMPLEMENTING_MATCH = %i[const regexp str sym].freeze
|
|
84
|
-
MSG = 'Use
|
|
84
|
+
MSG = 'Use `%<negation>smatch?` instead of `%<current>s` when `MatchData` is not used.'
|
|
85
85
|
|
|
86
86
|
def_node_matcher :match_method?, <<~PATTERN
|
|
87
87
|
{
|
|
@@ -175,7 +175,9 @@ module RuboCop
|
|
|
175
175
|
end
|
|
176
176
|
|
|
177
177
|
def message(node)
|
|
178
|
-
|
|
178
|
+
negation = ('!' if node.send_type? && node.method?(:!~))
|
|
179
|
+
|
|
180
|
+
format(MSG, negation: negation, current: node.loc.selector.source)
|
|
179
181
|
end
|
|
180
182
|
|
|
181
183
|
def last_match_used?(match_node)
|
|
@@ -19,6 +19,7 @@ module RuboCop
|
|
|
19
19
|
|
|
20
20
|
MSG = 'Use `%<prefer>s` instead.'
|
|
21
21
|
|
|
22
|
+
# rubocop:disable-next InternalAffairs/ItblockHandler -- `it` block accepts only a single block parameter.
|
|
22
23
|
def on_block(node)
|
|
23
24
|
sort_with_block?(node) do |send, var_a, var_b, body|
|
|
24
25
|
replaceable_body?(body, var_b, var_a) do
|
|
@@ -35,7 +35,7 @@ module RuboCop
|
|
|
35
35
|
(str $_))
|
|
36
36
|
PATTERN
|
|
37
37
|
|
|
38
|
-
# rubocop:disable Metrics/AbcSize
|
|
38
|
+
# rubocop:disable-next Metrics/AbcSize
|
|
39
39
|
def on_send(node)
|
|
40
40
|
squeeze_candidate?(node) do |receiver, bad_method, regexp_str, replace_str|
|
|
41
41
|
regexp_str = regexp_str[0..-2] # delete '+' from the end
|
|
@@ -57,7 +57,6 @@ module RuboCop
|
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
|
-
# rubocop:enable Metrics/AbcSize
|
|
61
60
|
alias on_csend on_send
|
|
62
61
|
|
|
63
62
|
private
|
|
@@ -33,7 +33,7 @@ module RuboCop
|
|
|
33
33
|
(send (regexp (str $#literal?) (regopt)) :=~ $_)}
|
|
34
34
|
PATTERN
|
|
35
35
|
|
|
36
|
-
# rubocop:disable Metrics/AbcSize
|
|
36
|
+
# rubocop:disable-next Metrics/AbcSize
|
|
37
37
|
def on_send(node)
|
|
38
38
|
return unless (receiver, regex_str = redundant_regex?(node))
|
|
39
39
|
|
|
@@ -50,7 +50,6 @@ module RuboCop
|
|
|
50
50
|
corrector.replace(node, new_source)
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
|
-
# rubocop:enable Metrics/AbcSize
|
|
54
53
|
alias on_csend on_send
|
|
55
54
|
alias on_match_with_lvasgn on_send
|
|
56
55
|
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'mixin'
|
|
4
|
+
|
|
5
|
+
module RuboCop
|
|
6
|
+
module Cop
|
|
7
|
+
# Cops for the `Performance` department. The department's cops are registered for lazy loading
|
|
8
|
+
# and their files are loaded on demand.
|
|
9
|
+
module Performance
|
|
10
|
+
extend LazyLoader
|
|
11
|
+
|
|
12
|
+
register_cop :AncestorsInclude, "#{__dir__}/performance/ancestors_include"
|
|
13
|
+
register_cop :ArraySemiInfiniteRangeSlice, "#{__dir__}/performance/array_semi_infinite_range_slice"
|
|
14
|
+
register_cop :BigDecimalWithNumericArgument, "#{__dir__}/performance/big_decimal_with_numeric_argument"
|
|
15
|
+
register_cop :BindCall, "#{__dir__}/performance/bind_call"
|
|
16
|
+
register_cop :BlockGivenWithExplicitBlock, "#{__dir__}/performance/block_given_with_explicit_block"
|
|
17
|
+
register_cop :Caller, "#{__dir__}/performance/caller"
|
|
18
|
+
register_cop :CaseWhenSplat, "#{__dir__}/performance/case_when_splat"
|
|
19
|
+
register_cop :Casecmp, "#{__dir__}/performance/casecmp"
|
|
20
|
+
register_cop :CollectionLiteralInLoop, "#{__dir__}/performance/collection_literal_in_loop"
|
|
21
|
+
register_cop :CompareWithBlock, "#{__dir__}/performance/compare_with_block"
|
|
22
|
+
register_cop :ConcurrentMonotonicTime, "#{__dir__}/performance/concurrent_monotonic_time"
|
|
23
|
+
register_cop :ConstantRegexp, "#{__dir__}/performance/constant_regexp"
|
|
24
|
+
register_cop :Count, "#{__dir__}/performance/count"
|
|
25
|
+
register_cop :DeletePrefix, "#{__dir__}/performance/delete_prefix"
|
|
26
|
+
register_cop :DeleteSuffix, "#{__dir__}/performance/delete_suffix"
|
|
27
|
+
register_cop :Detect, "#{__dir__}/performance/detect"
|
|
28
|
+
register_cop :DoubleStartEndWith, "#{__dir__}/performance/double_start_end_with"
|
|
29
|
+
register_cop :EndWith, "#{__dir__}/performance/end_with"
|
|
30
|
+
register_cop :FixedSize, "#{__dir__}/performance/fixed_size"
|
|
31
|
+
register_cop :FlatMap, "#{__dir__}/performance/flat_map"
|
|
32
|
+
register_cop :InefficientHashSearch, "#{__dir__}/performance/inefficient_hash_search"
|
|
33
|
+
register_cop :MapCompact, "#{__dir__}/performance/map_compact"
|
|
34
|
+
register_cop :MapMethodChain, "#{__dir__}/performance/map_method_chain"
|
|
35
|
+
register_cop :MethodObjectAsBlock, "#{__dir__}/performance/method_object_as_block"
|
|
36
|
+
register_cop :OpenStruct, "#{__dir__}/performance/open_struct"
|
|
37
|
+
register_cop :RangeInclude, "#{__dir__}/performance/range_include"
|
|
38
|
+
register_cop :IoReadlines, "#{__dir__}/performance/io_readlines"
|
|
39
|
+
register_cop :RedundantBlockCall, "#{__dir__}/performance/redundant_block_call"
|
|
40
|
+
register_cop :RedundantEqualityComparisonBlock, "#{__dir__}/performance/redundant_equality_comparison_block"
|
|
41
|
+
register_cop :RedundantMatch, "#{__dir__}/performance/redundant_match"
|
|
42
|
+
register_cop :RedundantMerge, "#{__dir__}/performance/redundant_merge"
|
|
43
|
+
register_cop :RedundantSortBlock, "#{__dir__}/performance/redundant_sort_block"
|
|
44
|
+
register_cop :RedundantSplitRegexpArgument, "#{__dir__}/performance/redundant_split_regexp_argument"
|
|
45
|
+
register_cop :RedundantStringChars, "#{__dir__}/performance/redundant_string_chars"
|
|
46
|
+
register_cop :RegexpMatch, "#{__dir__}/performance/regexp_match"
|
|
47
|
+
register_cop :ReverseEach, "#{__dir__}/performance/reverse_each"
|
|
48
|
+
register_cop :ReverseFirst, "#{__dir__}/performance/reverse_first"
|
|
49
|
+
register_cop :SelectMap, "#{__dir__}/performance/select_map"
|
|
50
|
+
register_cop :Size, "#{__dir__}/performance/size"
|
|
51
|
+
register_cop :SortReverse, "#{__dir__}/performance/sort_reverse"
|
|
52
|
+
register_cop :Squeeze, "#{__dir__}/performance/squeeze"
|
|
53
|
+
register_cop :StringBytesize, "#{__dir__}/performance/string_bytesize"
|
|
54
|
+
register_cop :StartWith, "#{__dir__}/performance/start_with"
|
|
55
|
+
register_cop :StringIdentifierArgument, "#{__dir__}/performance/string_identifier_argument"
|
|
56
|
+
register_cop :StringInclude, "#{__dir__}/performance/string_include"
|
|
57
|
+
register_cop :StringReplacement, "#{__dir__}/performance/string_replacement"
|
|
58
|
+
register_cop :Sum, "#{__dir__}/performance/sum"
|
|
59
|
+
register_cop :TimesMap, "#{__dir__}/performance/times_map"
|
|
60
|
+
register_cop :UnfreezeString, "#{__dir__}/performance/unfreeze_string"
|
|
61
|
+
register_cop :UriDefaultParser, "#{__dir__}/performance/uri_default_parser"
|
|
62
|
+
register_cop :ChainArrayAllocation, "#{__dir__}/performance/chain_array_allocation"
|
|
63
|
+
register_cop :ZipWithoutBlock, "#{__dir__}/performance/zip_without_block"
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -1,57 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
require_relative 'performance
|
|
7
|
-
require_relative 'performance/array_semi_infinite_range_slice'
|
|
8
|
-
require_relative 'performance/big_decimal_with_numeric_argument'
|
|
9
|
-
require_relative 'performance/bind_call'
|
|
10
|
-
require_relative 'performance/block_given_with_explicit_block'
|
|
11
|
-
require_relative 'performance/caller'
|
|
12
|
-
require_relative 'performance/case_when_splat'
|
|
13
|
-
require_relative 'performance/casecmp'
|
|
14
|
-
require_relative 'performance/collection_literal_in_loop'
|
|
15
|
-
require_relative 'performance/compare_with_block'
|
|
16
|
-
require_relative 'performance/concurrent_monotonic_time'
|
|
17
|
-
require_relative 'performance/constant_regexp'
|
|
18
|
-
require_relative 'performance/count'
|
|
19
|
-
require_relative 'performance/delete_prefix'
|
|
20
|
-
require_relative 'performance/delete_suffix'
|
|
21
|
-
require_relative 'performance/detect'
|
|
22
|
-
require_relative 'performance/double_start_end_with'
|
|
23
|
-
require_relative 'performance/end_with'
|
|
24
|
-
require_relative 'performance/fixed_size'
|
|
25
|
-
require_relative 'performance/flat_map'
|
|
26
|
-
require_relative 'performance/inefficient_hash_search'
|
|
27
|
-
require_relative 'performance/map_compact'
|
|
28
|
-
require_relative 'performance/map_method_chain'
|
|
29
|
-
require_relative 'performance/method_object_as_block'
|
|
30
|
-
require_relative 'performance/open_struct'
|
|
31
|
-
require_relative 'performance/range_include'
|
|
32
|
-
require_relative 'performance/io_readlines'
|
|
33
|
-
require_relative 'performance/redundant_block_call'
|
|
34
|
-
require_relative 'performance/redundant_equality_comparison_block'
|
|
35
|
-
require_relative 'performance/redundant_match'
|
|
36
|
-
require_relative 'performance/redundant_merge'
|
|
37
|
-
require_relative 'performance/redundant_sort_block'
|
|
38
|
-
require_relative 'performance/redundant_split_regexp_argument'
|
|
39
|
-
require_relative 'performance/redundant_string_chars'
|
|
40
|
-
require_relative 'performance/regexp_match'
|
|
41
|
-
require_relative 'performance/reverse_each'
|
|
42
|
-
require_relative 'performance/reverse_first'
|
|
43
|
-
require_relative 'performance/select_map'
|
|
44
|
-
require_relative 'performance/size'
|
|
45
|
-
require_relative 'performance/sort_reverse'
|
|
46
|
-
require_relative 'performance/squeeze'
|
|
47
|
-
require_relative 'performance/string_bytesize'
|
|
48
|
-
require_relative 'performance/start_with'
|
|
49
|
-
require_relative 'performance/string_identifier_argument'
|
|
50
|
-
require_relative 'performance/string_include'
|
|
51
|
-
require_relative 'performance/string_replacement'
|
|
52
|
-
require_relative 'performance/sum'
|
|
53
|
-
require_relative 'performance/times_map'
|
|
54
|
-
require_relative 'performance/unfreeze_string'
|
|
55
|
-
require_relative 'performance/uri_default_parser'
|
|
56
|
-
require_relative 'performance/chain_array_allocation'
|
|
57
|
-
require_relative 'performance/zip_without_block'
|
|
3
|
+
# @deprecated This file is deprecated. Cops are registered for lazy loading in
|
|
4
|
+
# `rubocop/cop/performance`; this file is kept for compatibility with code
|
|
5
|
+
# that requires it directly.
|
|
6
|
+
require_relative 'performance'
|
data/lib/rubocop-performance.rb
CHANGED
|
@@ -5,7 +5,7 @@ require 'rubocop'
|
|
|
5
5
|
require_relative 'rubocop/performance'
|
|
6
6
|
require_relative 'rubocop/performance/version'
|
|
7
7
|
require_relative 'rubocop/performance/plugin'
|
|
8
|
-
require_relative 'rubocop/cop/
|
|
8
|
+
require_relative 'rubocop/cop/performance'
|
|
9
9
|
|
|
10
10
|
autocorrect_incompatible_with_block_given_with_explicit_block = Module.new do
|
|
11
11
|
def autocorrect_incompatible_with
|
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.27.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bozhidar Batsov
|
|
@@ -31,7 +31,7 @@ dependencies:
|
|
|
31
31
|
requirements:
|
|
32
32
|
- - ">="
|
|
33
33
|
- !ruby/object:Gem::Version
|
|
34
|
-
version: 1.
|
|
34
|
+
version: 1.89.0
|
|
35
35
|
- - "<"
|
|
36
36
|
- !ruby/object:Gem::Version
|
|
37
37
|
version: '2.0'
|
|
@@ -41,7 +41,7 @@ dependencies:
|
|
|
41
41
|
requirements:
|
|
42
42
|
- - ">="
|
|
43
43
|
- !ruby/object:Gem::Version
|
|
44
|
-
version: 1.
|
|
44
|
+
version: 1.89.0
|
|
45
45
|
- - "<"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
47
|
version: '2.0'
|
|
@@ -51,7 +51,7 @@ dependencies:
|
|
|
51
51
|
requirements:
|
|
52
52
|
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: 1.
|
|
54
|
+
version: 1.47.1
|
|
55
55
|
- - "<"
|
|
56
56
|
- !ruby/object:Gem::Version
|
|
57
57
|
version: '2.0'
|
|
@@ -61,7 +61,7 @@ dependencies:
|
|
|
61
61
|
requirements:
|
|
62
62
|
- - ">="
|
|
63
63
|
- !ruby/object:Gem::Version
|
|
64
|
-
version: 1.
|
|
64
|
+
version: 1.47.1
|
|
65
65
|
- - "<"
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
67
|
version: '2.0'
|
|
@@ -80,8 +80,10 @@ files:
|
|
|
80
80
|
- config/default.yml
|
|
81
81
|
- config/obsoletion.yml
|
|
82
82
|
- lib/rubocop-performance.rb
|
|
83
|
+
- lib/rubocop/cop/mixin.rb
|
|
83
84
|
- lib/rubocop/cop/mixin/regexp_metacharacter.rb
|
|
84
85
|
- lib/rubocop/cop/mixin/sort_block.rb
|
|
86
|
+
- lib/rubocop/cop/performance.rb
|
|
85
87
|
- lib/rubocop/cop/performance/ancestors_include.rb
|
|
86
88
|
- lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb
|
|
87
89
|
- lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb
|
|
@@ -145,7 +147,7 @@ metadata:
|
|
|
145
147
|
homepage_uri: https://docs.rubocop.org/rubocop-performance/
|
|
146
148
|
changelog_uri: https://github.com/rubocop/rubocop-performance/blob/master/CHANGELOG.md
|
|
147
149
|
source_code_uri: https://github.com/rubocop/rubocop-performance/
|
|
148
|
-
documentation_uri: https://docs.rubocop.org/rubocop-performance/1.
|
|
150
|
+
documentation_uri: https://docs.rubocop.org/rubocop-performance/1.27/
|
|
149
151
|
bug_tracker_uri: https://github.com/rubocop/rubocop-performance/issues
|
|
150
152
|
rubygems_mfa_required: 'true'
|
|
151
153
|
default_lint_roller_plugin: RuboCop::Performance::Plugin
|
|
@@ -163,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
163
165
|
- !ruby/object:Gem::Version
|
|
164
166
|
version: '0'
|
|
165
167
|
requirements: []
|
|
166
|
-
rubygems_version:
|
|
168
|
+
rubygems_version: 4.0.3
|
|
167
169
|
specification_version: 4
|
|
168
170
|
summary: Automatic performance checking tool for Ruby code.
|
|
169
171
|
test_files: []
|