rubocop-performance 1.14.2 → 1.14.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ee2574c244ab81c1e05e9eb8244ac9e912c2e0d5c66515992d6b18469edc4f4
4
- data.tar.gz: e10cd6a0484f3be598c8f6b072b0e9f1b0fd26fbf69ffc5441ace5194d746956
3
+ metadata.gz: 7716dc36d8facd9d8604d89d117f85db5fed60efcad66ad8354d673492800140
4
+ data.tar.gz: 59f4dd4e4df5afef36700a8951e8e91e18567ba978506d9aa02884abafc6d639
5
5
  SHA512:
6
- metadata.gz: 872712b17371fa9b027b7641d1f7ab76c93f74929a0761ee6146acdaf7b3224feb79dd40680066060e56d9c7f8466115a446c2cdaf159347f0235019adae5124
7
- data.tar.gz: 4d53b7e1a736af1a40b76e0f33f0ba628549e4de779376ad92e9356e2be5494d8fdd04eefc8efe274a255d11fe8e473816b5a7e4f09d2b7d2b6ff84c0eb6ba35
6
+ metadata.gz: 748977ac053ddab36afda43c709eee6424957a81ce18daf1048cf42399226e0d2d67f9964ba544594a03862d5650eff369a34b407d49892d72957ab3acf2ca11
7
+ data.tar.gz: 9a785cd79f0e781643720fd19e2454d6b1cac890c215d5a44762e4173d69e9f6ec6adc57fe43646dba7b3e48bf86663842f595f54db1f51c7e251af75113ecee
data/config/default.yml CHANGED
@@ -160,7 +160,7 @@ Performance/FlatMap:
160
160
  Description: >-
161
161
  Use `Enumerable#flat_map`
162
162
  instead of `Enumerable#map...Array#flatten(1)`
163
- or `Enumberable#collect..Array#flatten(1)`.
163
+ or `Enumerable#collect..Array#flatten(1)`.
164
164
  Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
165
165
  Enabled: true
166
166
  VersionAdded: '0.30'
@@ -47,13 +47,13 @@ module RuboCop
47
47
 
48
48
  RETURNS_NEW_ARRAY = (ALWAYS_RETURNS_NEW_ARRAY + RETURNS_NEW_ARRAY_WHEN_NO_BLOCK).freeze
49
49
 
50
- MSG = 'Use unchained `%<method>s` and `%<second_method>s!` '\
51
- '(followed by `return array` if required) instead of chaining '\
50
+ MSG = 'Use unchained `%<method>s` and `%<second_method>s!` ' \
51
+ '(followed by `return array` if required) instead of chaining ' \
52
52
  '`%<method>s...%<second_method>s`.'
53
53
 
54
54
  def_node_matcher :chain_array_allocation?, <<~PATTERN
55
55
  (send {
56
- (send _ $%RETURN_NEW_ARRAY_WHEN_ARGS {int lvar ivar cvar gvar})
56
+ (send _ $%RETURN_NEW_ARRAY_WHEN_ARGS {int lvar ivar cvar gvar send})
57
57
  (block (send _ $%ALWAYS_RETURNS_NEW_ARRAY) ...)
58
58
  (send _ $%RETURNS_NEW_ARRAY ...)
59
59
  } $%HAS_MUTATION_ALTERNATIVE ...)
@@ -32,7 +32,7 @@ module RuboCop
32
32
  # end
33
33
  #
34
34
  class CollectionLiteralInLoop < Base
35
- MSG = 'Avoid immutable %<literal_class>s literals in loops. '\
35
+ MSG = 'Avoid immutable %<literal_class>s literals in loops. ' \
36
36
  'It is better to extract it into a local variable or a constant.'
37
37
 
38
38
  POST_CONDITION_LOOP_TYPES = %i[while_post until_post].freeze
@@ -58,8 +58,7 @@ module RuboCop
58
58
  # `key?`/`value?` method.
59
59
  corrector.replace(
60
60
  node.loc.expression,
61
- "#{autocorrect_hash_expression(node)}."\
62
- "#{autocorrect_method(node)}(#{autocorrect_argument(node)})"
61
+ "#{autocorrect_hash_expression(node)}.#{autocorrect_method(node)}(#{autocorrect_argument(node)})"
63
62
  )
64
63
  end
65
64
  end
@@ -68,8 +67,7 @@ module RuboCop
68
67
  private
69
68
 
70
69
  def message(node)
71
- "Use `##{autocorrect_method(node)}` instead of "\
72
- "`##{current_method(node)}.include?`."
70
+ "Use `##{autocorrect_method(node)}` instead of `##{current_method(node)}.include?`."
73
71
  end
74
72
 
75
73
  def autocorrect_method(node)
@@ -38,7 +38,7 @@ module RuboCop
38
38
  remove_class_variable remove_method undef_method class_variable_get class_variable_set
39
39
  deprecate_constant module_function private private_constant protected public public_constant
40
40
  remove_const ruby2_keywords
41
- define_singleton_method instance_variable_defined instance_variable_get instance_variable_set
41
+ define_singleton_method instance_variable_defined? instance_variable_get instance_variable_set
42
42
  method public_method public_send remove_instance_variable respond_to? send singleton_method
43
43
  __send__
44
44
  ].freeze
@@ -7,7 +7,7 @@ module RuboCop
7
7
  # in some Enumerable object can be replaced by `Enumerable#sum` method.
8
8
  #
9
9
  # @safety
10
- # Auto-corrections are unproblematic wherever an initial value is provided explicitly:
10
+ # Autocorrections are unproblematic wherever an initial value is provided explicitly:
11
11
  #
12
12
  # [source,ruby]
13
13
  # ----
@@ -43,7 +43,7 @@ module RuboCop
43
43
  #
44
44
  # @example OnlySumOrWithInitialValue: false (default)
45
45
  # # bad
46
- # [1, 2, 3].inject(:+) # Auto-corrections for cases without initial value are unsafe
46
+ # [1, 2, 3].inject(:+) # Autocorrections for cases without initial value are unsafe
47
47
  # [1, 2, 3].inject(&:+) # and will only be performed when using the `-A` option.
48
48
  # [1, 2, 3].reduce { |acc, elem| acc + elem } # They can be prohibited completely using `SafeAutoCorrect: true`.
49
49
  # [1, 2, 3].reduce(10, :+)
@@ -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.14.2'
7
+ STRING = '1.14.3'
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.14.2
4
+ version: 1.14.3
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: 2022-06-07 00:00:00.000000000 Z
13
+ date: 2022-07-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubocop