rubocop-performance 1.9.0 → 1.10.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b44c147120a9f64f16a0bf21782f1dbe0a51c64170c3a5c217e548eded4e106
4
- data.tar.gz: 7b4e6e464ee3631071f3bd3f447acde2a59763d326a86658412f4ec9527850a6
3
+ metadata.gz: 739dfb0dfbef0fa9962b144cb8cb3c600b801a86adc11877898a8eba957a2f39
4
+ data.tar.gz: 0c5f89ad71bbe81a9c9e42c418401039c9dc0f2ede40fd54c3ba1bc4955011f9
5
5
  SHA512:
6
- metadata.gz: e450740a348bd17e276af8393f4e8225521afc4c9fac5816c9a3bbd9883d16a15f28a1044e24b89c9037593f4d2931cf3dc900385d42d7ad035dbb1dd461a306
7
- data.tar.gz: feef1ae1d9735d3abadf17799ecfb4840ce359fa932902387633e67dc15e1eeb62573ae0a2832c050a8722e004f614c109483a9d8857143f28c866dbd65bc5bf
6
+ metadata.gz: 07cb8c4fc7d80cac74841d9c8bdde26397c4e4273d2ef80b805388020c17cf6820c497a8ea4bfc4a39ca93f538fc2b642399e9fdb1acc401e2e0dad1bf5596d8
7
+ data.tar.gz: 74696267b3ad0b9ab49aeacfab1de661ab22140a5cea173caa82ddd206159dadc214b996812a5521d1f912c44dfa84cca822d5159c2d8b45426fe1aa55d00896
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-20 Bozhidar Batsov
1
+ Copyright (c) 2012-21 Bozhidar Batsov
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # RuboCop Performance
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/rubocop-performance.svg)](https://badge.fury.io/rb/rubocop-performance)
4
- [![CircleCI](https://circleci.com/gh/rubocop-hq/rubocop-performance.svg?style=svg)](https://circleci.com/gh/rubocop-hq/rubocop-performance)
4
+ [![CircleCI](https://circleci.com/gh/rubocop/rubocop-performance.svg?style=svg)](https://circleci.com/gh/rubocop/rubocop-performance)
5
5
 
6
- Performance optimization analysis for your projects, as an extension to [RuboCop](https://github.com/rubocop-hq/rubocop).
6
+ Performance optimization analysis for your projects, as an extension to [RuboCop](https://github.com/rubocop/rubocop).
7
7
 
8
8
  ## Installation
9
9
 
data/config/default.yml CHANGED
@@ -9,7 +9,11 @@ Performance/AncestorsInclude:
9
9
 
10
10
  Performance/ArraySemiInfiniteRangeSlice:
11
11
  Description: 'Identifies places where slicing arrays with semi-infinite ranges can be replaced by `Array#take` and `Array#drop`.'
12
- Enabled: pending
12
+ # This cop was created due to a mistake in microbenchmark.
13
+ # Refer https://github.com/rubocop/rubocop-performance/pull/175#issuecomment-731892717
14
+ Enabled: false
15
+ # Unsafe for string slices because strings do not have `#take` and `#drop` methods.
16
+ Safe: false
13
17
  VersionAdded: '1.9'
14
18
 
15
19
  Performance/BigDecimalWithNumericArgument:
@@ -76,6 +80,7 @@ Performance/ConstantRegexp:
76
80
  Description: 'Finds regular expressions with dynamic components that are all constants.'
77
81
  Enabled: pending
78
82
  VersionAdded: '1.9'
83
+ VersionChanged: '1.10'
79
84
 
80
85
  Performance/Count:
81
86
  Description: >-
@@ -132,11 +137,10 @@ Performance/EndWith:
132
137
  # object. Switching these methods has to be done with knowledge of the types
133
138
  # of the variables which rubocop doesn't have.
134
139
  SafeAutoCorrect: false
135
- AutoCorrect: false
136
140
  Enabled: true
137
141
  SafeMultiline: true
138
142
  VersionAdded: '0.36'
139
- VersionChanged: '1.6'
143
+ VersionChanged: '1.10'
140
144
 
141
145
  Performance/FixedSize:
142
146
  Description: 'Do not compute the size of statically sized objects except in constants.'
@@ -196,6 +200,15 @@ Performance/RedundantBlockCall:
196
200
  Enabled: true
197
201
  VersionAdded: '0.36'
198
202
 
203
+ Performance/RedundantEqualityComparisonBlock:
204
+ Description: >-
205
+ Checks for uses `Enumerable#all?`, `Enumerable#any?`, `Enumerable#one?`,
206
+ or `Enumerable#none?` are compared with `===` or similar methods in block.
207
+ Reference: 'https://github.com/rails/rails/pull/41363'
208
+ Enabled: pending
209
+ Safe: false
210
+ VersionAdded: '1.10'
211
+
199
212
  Performance/RedundantMatch:
200
213
  Description: >-
201
214
  Use `=~` instead of `String#match` or `Regexp#match` in a context where the
@@ -216,6 +229,11 @@ Performance/RedundantSortBlock:
216
229
  Enabled: 'pending'
217
230
  VersionAdded: '1.7'
218
231
 
232
+ Performance/RedundantSplitRegexpArgument:
233
+ Description: 'This cop identifies places where `split` argument can be replaced from a deterministic regexp to a string.'
234
+ Enabled: pending
235
+ VersionAdded: '1.10'
236
+
219
237
  Performance/RedundantStringChars:
220
238
  Description: 'Checks for redundant `String#chars`.'
221
239
  Enabled: 'pending'
@@ -266,11 +284,10 @@ Performance/StartWith:
266
284
  # object. Switching these methods has to be done with knowledge of the types
267
285
  # of the variables which rubocop doesn't have.
268
286
  SafeAutoCorrect: false
269
- AutoCorrect: false
270
287
  Enabled: true
271
288
  SafeMultiline: true
272
289
  VersionAdded: '0.36'
273
- VersionChanged: '1.6'
290
+ VersionChanged: '1.10'
274
291
 
275
292
  Performance/StringInclude:
276
293
  Description: 'Use `String#include?` instead of a regex match with literal-only pattern.'
@@ -300,7 +317,7 @@ Performance/TimesMap:
300
317
  Enabled: true
301
318
  VersionAdded: '0.36'
302
319
  VersionChanged: '0.50'
303
- SafeAutoCorrect: false # see https://github.com/rubocop-hq/rubocop/issues/4658
320
+ SafeAutoCorrect: false # see https://github.com/rubocop/rubocop/issues/4658
304
321
 
305
322
  Performance/UnfreezeString:
306
323
  Description: 'Use unary plus to get an unfrozen string literal.'
@@ -5,6 +5,9 @@ module RuboCop
5
5
  module Performance
6
6
  # This cop identifies places where slicing arrays with semi-infinite ranges
7
7
  # can be replaced by `Array#take` and `Array#drop`.
8
+ # This cop was created due to a mistake in microbenchmark and hence is disabled by default.
9
+ # Refer https://github.com/rubocop/rubocop-performance/pull/175#issuecomment-731892717
10
+ # This cop is also unsafe for string slices because strings do not have `#take` and `#drop` methods.
8
11
  #
9
12
  # @example
10
13
  # # bad
@@ -33,7 +33,7 @@ module RuboCop
33
33
  def_node_matcher :bind_with_call_method?, <<~PATTERN
34
34
  (send
35
35
  $(send
36
- (send nil? _) :bind
36
+ _ :bind
37
37
  $(...)) :call
38
38
  $...)
39
39
  PATTERN
@@ -64,7 +64,7 @@ module RuboCop
64
64
 
65
65
  def correction_range(receiver, node)
66
66
  location_of_bind = receiver.loc.selector.begin_pos
67
- location_of_call = node.loc.end.end_pos
67
+ location_of_call = node.source_range.end.end_pos
68
68
 
69
69
  range_between(location_of_bind, location_of_call)
70
70
  end
@@ -29,38 +29,40 @@ module RuboCop
29
29
  # [1,2].first # => 1
30
30
  # [1,2].first(1) # => [1]
31
31
  #
32
- RETURN_NEW_ARRAY_WHEN_ARGS = ':first :last :pop :sample :shift '
32
+ RETURN_NEW_ARRAY_WHEN_ARGS = %i[first last pop sample shift].to_set.freeze
33
33
 
34
34
  # These methods return a new array only when called without a block.
35
- RETURNS_NEW_ARRAY_WHEN_NO_BLOCK = ':zip :product '
35
+ RETURNS_NEW_ARRAY_WHEN_NO_BLOCK = %i[zip product].to_set.freeze
36
36
 
37
37
  # These methods ALWAYS return a new array
38
38
  # after they're called it's safe to mutate the the resulting array
39
- ALWAYS_RETURNS_NEW_ARRAY = ':* :+ :- :collect :compact :drop '\
40
- ':drop_while :flatten :map :reject ' \
41
- ':reverse :rotate :select :shuffle :sort ' \
42
- ':take :take_while :transpose :uniq ' \
43
- ':values_at :| '
39
+ ALWAYS_RETURNS_NEW_ARRAY = %i[* + - collect compact drop
40
+ drop_while flatten map reject
41
+ reverse rotate select shuffle sort
42
+ take take_while transpose uniq
43
+ values_at |].to_set.freeze
44
44
 
45
45
  # These methods have a mutation alternative. For example :collect
46
46
  # can be called as :collect!
47
- HAS_MUTATION_ALTERNATIVE = ':collect :compact :flatten :map :reject '\
48
- ':reverse :rotate :select :shuffle :sort '\
49
- ':uniq '
50
- MSG = 'Use unchained `%<method>s!` and `%<second_method>s!` '\
47
+ HAS_MUTATION_ALTERNATIVE = %i[collect compact flatten map reject
48
+ reverse rotate select shuffle sort uniq].to_set.freeze
49
+
50
+ RETURNS_NEW_ARRAY = (ALWAYS_RETURNS_NEW_ARRAY + RETURNS_NEW_ARRAY_WHEN_NO_BLOCK).freeze
51
+
52
+ MSG = 'Use unchained `%<method>s` and `%<second_method>s!` '\
51
53
  '(followed by `return array` if required) instead of chaining '\
52
54
  '`%<method>s...%<second_method>s`.'
53
55
 
54
- def_node_matcher :flat_map_candidate?, <<~PATTERN
55
- {
56
- (send (send _ ${#{RETURN_NEW_ARRAY_WHEN_ARGS}} {int lvar ivar cvar gvar}) ${#{HAS_MUTATION_ALTERNATIVE}} $...)
57
- (send (block (send _ ${#{ALWAYS_RETURNS_NEW_ARRAY} }) ...) ${#{HAS_MUTATION_ALTERNATIVE}} $...)
58
- (send (send _ ${#{ALWAYS_RETURNS_NEW_ARRAY + RETURNS_NEW_ARRAY_WHEN_NO_BLOCK}} ...) ${#{HAS_MUTATION_ALTERNATIVE}} $...)
59
- }
56
+ def_node_matcher :chain_array_allocation?, <<~PATTERN
57
+ (send {
58
+ (send _ $%RETURN_NEW_ARRAY_WHEN_ARGS {int lvar ivar cvar gvar})
59
+ (block (send _ $%ALWAYS_RETURNS_NEW_ARRAY) ...)
60
+ (send _ $%RETURNS_NEW_ARRAY ...)
61
+ } $%HAS_MUTATION_ALTERNATIVE ...)
60
62
  PATTERN
61
63
 
62
64
  def on_send(node)
63
- flat_map_candidate?(node) do |fm, sm, _|
65
+ chain_array_allocation?(node) do |fm, sm|
64
66
  range = range_between(node.loc.dot.begin_pos, node.source_range.end_pos)
65
67
 
66
68
  add_offense(range, message: format(MSG, method: fm, second_method: sm))
@@ -6,9 +6,9 @@ module RuboCop
6
6
  # This cop finds regular expressions with dynamic components that are all constants.
7
7
  #
8
8
  # Ruby allocates a new Regexp object every time it executes a code containing such
9
- # a regular expression. It is more efficient to extract it into a constant
10
- # or add an `/o` option to perform `#{}` interpolation only once and reuse that
11
- # Regexp object.
9
+ # a regular expression. It is more efficient to extract it into a constant,
10
+ # memoize it, or add an `/o` option to perform `#{}` interpolation only once and
11
+ # reuse that Regexp object.
12
12
  #
13
13
  # @example
14
14
  #
@@ -28,13 +28,18 @@ module RuboCop
28
28
  # pattern.scan(TOKEN).reject { |token| token.match?(/\A#{SEPARATORS}\Z/o) }
29
29
  # end
30
30
  #
31
+ # # good
32
+ # def separators
33
+ # @separators ||= /\A#{SEPARATORS}\Z/
34
+ # end
35
+ #
31
36
  class ConstantRegexp < Base
32
37
  extend AutoCorrector
33
38
 
34
- MSG = 'Extract this regexp into a constant or append an `/o` option to its options.'
39
+ MSG = 'Extract this regexp into a constant, memoize it, or append an `/o` option to its options.'
35
40
 
36
41
  def on_regexp(node)
37
- return if within_const_assignment?(node) ||
42
+ return if within_allowed_assignment?(node) ||
38
43
  !include_interpolated_const?(node) ||
39
44
  node.single_interpolation?
40
45
 
@@ -45,8 +50,8 @@ module RuboCop
45
50
 
46
51
  private
47
52
 
48
- def within_const_assignment?(node)
49
- node.each_ancestor(:casgn).any?
53
+ def within_allowed_assignment?(node)
54
+ node.each_ancestor(:casgn, :or_asgn).any?
50
55
  end
51
56
 
52
57
  def_node_matcher :regexp_escape?, <<~PATTERN
@@ -78,7 +78,7 @@ module RuboCop
78
78
  end
79
79
 
80
80
  def calls_to_report(argname, body)
81
- return [] if blockarg_assigned?(body, argname)
81
+ return [] if blockarg_assigned?(body, argname) || shadowed_block_argument?(body, argname)
82
82
 
83
83
  blockarg_calls(body, argname).map do |call|
84
84
  return [] if args_include_block_pass?(call)
@@ -87,6 +87,12 @@ module RuboCop
87
87
  end
88
88
  end
89
89
 
90
+ def shadowed_block_argument?(body, block_argument_of_method_signature)
91
+ return false unless body.block_type?
92
+
93
+ body.arguments.map(&:source).include?(block_argument_of_method_signature.to_s)
94
+ end
95
+
90
96
  def args_include_block_pass?(blockcall)
91
97
  _receiver, _call, *args = *blockcall
92
98
 
@@ -0,0 +1,89 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Performance
6
+ # This cop checks for uses `Enumerable#all?`, `Enumerable#any?`, `Enumerable#one?`,
7
+ # and `Enumerable#none?` are compared with `===` or similar methods in block.
8
+ #
9
+ # By default, `Object#===` behaves the same as `Object#==`, but this
10
+ # behavior is appropriately overridden in subclass. For example,
11
+ # `Range#===` returns `true` when argument is within the range.
12
+ # Therefore, It is marked as unsafe by default because `===` and `==`
13
+ # do not always behave the same.
14
+ #
15
+ # @example
16
+ # # bad
17
+ # items.all? { |item| pattern === item }
18
+ # items.all? { |item| item == other }
19
+ # items.all? { |item| item.is_a?(Klass) }
20
+ # items.all? { |item| item.kind_of?(Klass) }
21
+ #
22
+ # # good
23
+ # items.all?(pattern)
24
+ #
25
+ class RedundantEqualityComparisonBlock < Base
26
+ extend AutoCorrector
27
+ extend TargetRubyVersion
28
+
29
+ minimum_target_ruby_version 2.5
30
+
31
+ MSG = 'Use `%<prefer>s` instead of block.'
32
+
33
+ TARGET_METHODS = %i[all? any? one? none?].freeze
34
+ COMPARISON_METHODS = %i[== === is_a? kind_of?].freeze
35
+ IS_A_METHODS = %i[is_a? kind_of?].freeze
36
+
37
+ def on_block(node)
38
+ return unless TARGET_METHODS.include?(node.method_name)
39
+ return unless one_block_argument?(node.arguments)
40
+
41
+ block_argument = node.arguments.first
42
+ block_body = node.body
43
+ return unless use_equality_comparison_block?(block_body)
44
+ return if same_block_argument_and_is_a_argument?(block_body, block_argument)
45
+ return unless (new_argument = new_argument(block_argument, block_body))
46
+
47
+ range = offense_range(node)
48
+ prefer = "#{node.method_name}(#{new_argument})"
49
+
50
+ add_offense(range, message: format(MSG, prefer: prefer)) do |corrector|
51
+ corrector.replace(range, prefer)
52
+ end
53
+ end
54
+
55
+ private
56
+
57
+ def one_block_argument?(block_arguments)
58
+ block_arguments.one? && !block_arguments.source.include?(',')
59
+ end
60
+
61
+ def use_equality_comparison_block?(block_body)
62
+ block_body.send_type? && COMPARISON_METHODS.include?(block_body.method_name)
63
+ end
64
+
65
+ def same_block_argument_and_is_a_argument?(block_body, block_argument)
66
+ if block_body.method?(:===)
67
+ block_argument.source != block_body.children[2].source
68
+ elsif IS_A_METHODS.include?(block_body.method_name)
69
+ block_argument.source == block_body.first_argument.source
70
+ else
71
+ false
72
+ end
73
+ end
74
+
75
+ def new_argument(block_argument, block_body)
76
+ if block_argument.source == block_body.receiver.source
77
+ block_body.first_argument.source
78
+ elsif block_argument.source == block_body.first_argument.source
79
+ block_body.receiver.source
80
+ end
81
+ end
82
+
83
+ def offense_range(node)
84
+ node.send_node.loc.selector.join(node.source_range.end)
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Performance
6
+ # This cop identifies places where `split` argument can be replaced from
7
+ # a deterministic regexp to a string.
8
+ #
9
+ # @example
10
+ # # bad
11
+ # 'a,b,c'.split(/,/)
12
+ #
13
+ # # good
14
+ # 'a,b,c'.split(',')
15
+ class RedundantSplitRegexpArgument < Base
16
+ extend AutoCorrector
17
+
18
+ MSG = 'Use string as argument instead of regexp.'
19
+ RESTRICT_ON_SEND = %i[split].freeze
20
+ DETERMINISTIC_REGEX = /\A(?:#{LITERAL_REGEX})+\Z/.freeze
21
+ STR_SPECIAL_CHARS = %w[\n \" \' \\\\ \t \b \f \r].freeze
22
+
23
+ def_node_matcher :split_call_with_regexp?, <<~PATTERN
24
+ {(send !nil? :split $regexp)}
25
+ PATTERN
26
+
27
+ def on_send(node)
28
+ return unless (regexp_node = split_call_with_regexp?(node))
29
+ return if regexp_node.ignore_case? || regexp_node.content == ' '
30
+ return unless determinist_regexp?(regexp_node)
31
+
32
+ add_offense(regexp_node) do |corrector|
33
+ new_argument = replacement(regexp_node)
34
+
35
+ corrector.replace(regexp_node, "\"#{new_argument}\"")
36
+ end
37
+ end
38
+
39
+ private
40
+
41
+ def determinist_regexp?(regexp_node)
42
+ DETERMINISTIC_REGEX.match?(regexp_node.source)
43
+ end
44
+
45
+ def replacement(regexp_node)
46
+ regexp_content = regexp_node.content
47
+ stack = []
48
+ chars = regexp_content.chars.each_with_object([]) do |char, strings|
49
+ if stack.empty? && char == '\\'
50
+ stack.push(char)
51
+ else
52
+ strings << "#{stack.pop}#{char}"
53
+ end
54
+ end
55
+ chars.map do |char|
56
+ char = char.dup
57
+ char.delete!('\\') unless STR_SPECIAL_CHARS.include?(char)
58
+ char
59
+ end.join
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -6,41 +6,53 @@ module RuboCop
6
6
  # This cop is used to identify usages of `reverse.each` and
7
7
  # change them to use `reverse_each` instead.
8
8
  #
9
+ # If the return value is used, it will not be detected because the result will be different.
10
+ #
11
+ # [source,ruby]
12
+ # ----
13
+ # [1, 2, 3].reverse.each {} #=> [3, 2, 1]
14
+ # [1, 2, 3].reverse_each {} #=> [1, 2, 3]
15
+ # ----
16
+ #
9
17
  # @example
10
18
  # # bad
11
- # [].reverse.each
19
+ # items.reverse.each
12
20
  #
13
21
  # # good
14
- # [].reverse_each
22
+ # items.reverse_each
15
23
  class ReverseEach < Base
16
24
  include RangeHelp
17
25
  extend AutoCorrector
18
26
 
19
27
  MSG = 'Use `reverse_each` instead of `reverse.each`.'
20
28
  RESTRICT_ON_SEND = %i[each].freeze
21
- UNDERSCORE = '_'
22
29
 
23
30
  def_node_matcher :reverse_each?, <<~MATCHER
24
- (send $(send _ :reverse) :each)
31
+ (send (send _ :reverse) :each)
25
32
  MATCHER
26
33
 
27
34
  def on_send(node)
28
- reverse_each?(node) do |receiver|
29
- location_of_reverse = receiver.loc.selector.begin_pos
30
- end_location = node.loc.selector.end_pos
35
+ return if use_return_value?(node)
31
36
 
32
- range = range_between(location_of_reverse, end_location)
37
+ reverse_each?(node) do
38
+ range = offense_range(node)
33
39
 
34
40
  add_offense(range) do |corrector|
35
- corrector.replace(replacement_range(node), UNDERSCORE)
41
+ corrector.replace(range, 'reverse_each')
36
42
  end
37
43
  end
38
44
  end
39
45
 
40
46
  private
41
47
 
42
- def replacement_range(node)
43
- range_between(node.loc.dot.begin_pos, node.loc.selector.begin_pos)
48
+ def use_return_value?(node)
49
+ !!node.ancestors.detect do |ancestor|
50
+ ancestor.assignment? || ancestor.send_type? || ancestor.return_type?
51
+ end
52
+ end
53
+
54
+ def offense_range(node)
55
+ range_between(node.children.first.loc.selector.begin_pos, node.loc.selector.end_pos)
44
56
  end
45
57
  end
46
58
  end
@@ -150,7 +150,9 @@ module RuboCop
150
150
  replacement = build_good_method(init, block_pass)
151
151
 
152
152
  corrector.remove(sum_range)
153
- corrector.replace(map_range, ".#{replacement}")
153
+
154
+ dot = '.' if map.receiver
155
+ corrector.replace(map_range, "#{dot}#{replacement}")
154
156
  end
155
157
 
156
158
  def sum_method_range(node)
@@ -228,7 +230,11 @@ module RuboCop
228
230
  end
229
231
 
230
232
  def method_call_with_args_range(node)
231
- node.receiver.source_range.end.join(node.source_range.end)
233
+ if (receiver = node.receiver)
234
+ receiver.source_range.end.join(node.source_range.end)
235
+ else
236
+ node.source_range
237
+ end
232
238
  end
233
239
  end
234
240
  end
@@ -28,9 +28,11 @@ require_relative 'performance/open_struct'
28
28
  require_relative 'performance/range_include'
29
29
  require_relative 'performance/io_readlines'
30
30
  require_relative 'performance/redundant_block_call'
31
+ require_relative 'performance/redundant_equality_comparison_block'
31
32
  require_relative 'performance/redundant_match'
32
33
  require_relative 'performance/redundant_merge'
33
34
  require_relative 'performance/redundant_sort_block'
35
+ require_relative 'performance/redundant_split_regexp_argument'
34
36
  require_relative 'performance/redundant_string_chars'
35
37
  require_relative 'performance/regexp_match'
36
38
  require_relative 'performance/reverse_each'
@@ -4,7 +4,7 @@ module RuboCop
4
4
  module Performance
5
5
  # This module holds the RuboCop Performance version information.
6
6
  module Version
7
- STRING = '1.9.0'
7
+ STRING = '1.10.2'
8
8
 
9
9
  def self.document_version
10
10
  STRING.match('\d+\.\d+').to_s
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.9.0
4
+ version: 1.10.2
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-11-16 00:00:00.000000000 Z
13
+ date: 2021-03-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubocop
@@ -88,9 +88,11 @@ files:
88
88
  - lib/rubocop/cop/performance/open_struct.rb
89
89
  - lib/rubocop/cop/performance/range_include.rb
90
90
  - lib/rubocop/cop/performance/redundant_block_call.rb
91
+ - lib/rubocop/cop/performance/redundant_equality_comparison_block.rb
91
92
  - lib/rubocop/cop/performance/redundant_match.rb
92
93
  - lib/rubocop/cop/performance/redundant_merge.rb
93
94
  - lib/rubocop/cop/performance/redundant_sort_block.rb
95
+ - lib/rubocop/cop/performance/redundant_split_regexp_argument.rb
94
96
  - lib/rubocop/cop/performance/redundant_string_chars.rb
95
97
  - lib/rubocop/cop/performance/regexp_match.rb
96
98
  - lib/rubocop/cop/performance/reverse_each.rb
@@ -109,15 +111,15 @@ files:
109
111
  - lib/rubocop/performance.rb
110
112
  - lib/rubocop/performance/inject.rb
111
113
  - lib/rubocop/performance/version.rb
112
- homepage: https://github.com/rubocop-hq/rubocop-performance
114
+ homepage: https://github.com/rubocop/rubocop-performance
113
115
  licenses:
114
116
  - MIT
115
117
  metadata:
116
118
  homepage_uri: https://docs.rubocop.org/rubocop-performance/
117
- changelog_uri: https://github.com/rubocop-hq/rubocop-performance/blob/master/CHANGELOG.md
118
- source_code_uri: https://github.com/rubocop-hq/rubocop-performance/
119
- documentation_uri: https://docs.rubocop.org/rubocop-performance/1.9/
120
- bug_tracker_uri: https://github.com/rubocop-hq/rubocop-performance/issues
119
+ changelog_uri: https://github.com/rubocop/rubocop-performance/blob/master/CHANGELOG.md
120
+ source_code_uri: https://github.com/rubocop/rubocop-performance/
121
+ documentation_uri: https://docs.rubocop.org/rubocop-performance/1.10/
122
+ bug_tracker_uri: https://github.com/rubocop/rubocop-performance/issues
121
123
  post_install_message:
122
124
  rdoc_options: []
123
125
  require_paths:
@@ -133,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
135
  - !ruby/object:Gem::Version
134
136
  version: '0'
135
137
  requirements: []
136
- rubygems_version: 3.2.0.rc.2
138
+ rubygems_version: 3.2.12
137
139
  signing_key:
138
140
  specification_version: 4
139
141
  summary: Automatic performance checking tool for Ruby code.