rubocop 1.58.0 → 1.59.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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/config/default.yml +6 -0
  4. data/lib/rubocop/cop/layout/heredoc_indentation.rb +1 -1
  5. data/lib/rubocop/cop/layout/redundant_line_break.rb +2 -1
  6. data/lib/rubocop/cop/layout/single_line_block_chain.rb +1 -0
  7. data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +2 -2
  8. data/lib/rubocop/cop/lint/constant_overwritten_in_rescue.rb +1 -1
  9. data/lib/rubocop/cop/lint/hash_compare_by_identity.rb +2 -1
  10. data/lib/rubocop/cop/lint/it_without_arguments_in_block.rb +56 -0
  11. data/lib/rubocop/cop/lint/literal_assignment_in_condition.rb +16 -2
  12. data/lib/rubocop/cop/lint/next_without_accumulator.rb +6 -21
  13. data/lib/rubocop/cop/lint/number_conversion.rb +9 -4
  14. data/lib/rubocop/cop/lint/redundant_with_index.rb +2 -2
  15. data/lib/rubocop/cop/lint/redundant_with_object.rb +2 -2
  16. data/lib/rubocop/cop/lint/self_assignment.rb +1 -0
  17. data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +2 -2
  18. data/lib/rubocop/cop/lint/useless_times.rb +1 -1
  19. data/lib/rubocop/cop/metrics/abc_size.rb +3 -3
  20. data/lib/rubocop/cop/naming/constant_name.rb +1 -2
  21. data/lib/rubocop/cop/style/array_first_last.rb +1 -1
  22. data/lib/rubocop/cop/style/class_check.rb +1 -0
  23. data/lib/rubocop/cop/style/collection_compact.rb +7 -6
  24. data/lib/rubocop/cop/style/combinable_loops.rb +11 -0
  25. data/lib/rubocop/cop/style/concat_array_literals.rb +1 -0
  26. data/lib/rubocop/cop/style/date_time.rb +5 -4
  27. data/lib/rubocop/cop/style/each_with_object.rb +2 -2
  28. data/lib/rubocop/cop/style/exact_regexp_match.rb +2 -1
  29. data/lib/rubocop/cop/style/hash_each_methods.rb +29 -4
  30. data/lib/rubocop/cop/style/hash_except.rb +2 -1
  31. data/lib/rubocop/cop/style/map_compact_with_conditional_block.rb +3 -2
  32. data/lib/rubocop/cop/style/map_to_hash.rb +1 -0
  33. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +1 -0
  34. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +20 -0
  35. data/lib/rubocop/cop/style/next.rb +1 -1
  36. data/lib/rubocop/cop/style/operator_method_call.rb +2 -2
  37. data/lib/rubocop/cop/style/redundant_argument.rb +1 -0
  38. data/lib/rubocop/cop/style/redundant_fetch_block.rb +3 -3
  39. data/lib/rubocop/cop/style/redundant_parentheses.rb +5 -6
  40. data/lib/rubocop/cop/style/redundant_self.rb +17 -2
  41. data/lib/rubocop/cop/style/redundant_sort.rb +8 -7
  42. data/lib/rubocop/cop/style/redundant_sort_by.rb +2 -2
  43. data/lib/rubocop/cop/style/sample.rb +2 -1
  44. data/lib/rubocop/cop/style/select_by_regexp.rb +6 -5
  45. data/lib/rubocop/cop/style/single_argument_dig.rb +5 -2
  46. data/lib/rubocop/cop/style/string_chars.rb +1 -0
  47. data/lib/rubocop/cop/style/strip.rb +7 -4
  48. data/lib/rubocop/cop/style/unpack_first.rb +11 -14
  49. data/lib/rubocop/version.rb +1 -1
  50. data/lib/rubocop.rb +1 -0
  51. metadata +8 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b262d82d17790d0993cf662a3ede317cbddfbc38704ae0bbf3108d411fac02d1
4
- data.tar.gz: e9e7fd1969decd87a3b5e4760331f98bb5b12a48b44b91d9f5a71cb5b79edb89
3
+ metadata.gz: 236fd46f4a118eb34ff38fce1a147a116b2d30a7bf849ca809ece40aecabc694
4
+ data.tar.gz: 550ecc4682d191a6a429a6af299212a42aa459e0aee04d5f7cb6a20ded419ff4
5
5
  SHA512:
6
- metadata.gz: 9e6a605d355ff38cdd29726c5e81aeb884757f3fb431beff0dd64f83b05e015f56ec429eccca953142fd85745f3bdbc33b838f1541f7253d422c30ab38b5041d
7
- data.tar.gz: 2fb1647376fcb6c193fecd74478a3d8913b8efa2ede1bac4c7895d0c42ee94f0f5ec52628e85c3461f930cb9795d18240116f2972d406df136cf4a2fc73f1454
6
+ metadata.gz: 5c7cfaa0f6573e566bbbac89a993889cd0f0944ab5c012e0286da61021e2d3da6ed51f68fbbf6c71afd4b6d81c577d15228b7a6a2d93aed59d2dfcba61a9be63
7
+ data.tar.gz: 5cbb4256ff218ab5744fc3065f56061e5b0eab787d21dc30f3ded5972b789ffc2c24cd977fbaf3acbcc84abf36c5e3537a2eeb328dabb3becf29268eccaa81f8
data/README.md CHANGED
@@ -53,7 +53,7 @@ To prevent an unwanted RuboCop update you might want to use a conservative versi
53
53
  in your `Gemfile`:
54
54
 
55
55
  ```rb
56
- gem 'rubocop', '~> 1.58', require: false
56
+ gem 'rubocop', '~> 1.59', require: false
57
57
  ```
58
58
 
59
59
  See [our versioning policy](https://docs.rubocop.org/rubocop/versioning.html) for further details.
data/config/default.yml CHANGED
@@ -1963,6 +1963,12 @@ Lint/InterpolationCheck:
1963
1963
  VersionAdded: '0.50'
1964
1964
  VersionChanged: '1.40'
1965
1965
 
1966
+ Lint/ItWithoutArgumentsInBlock:
1967
+ Description: 'Checks uses of `it` calls without arguments in block.'
1968
+ Reference: 'https://bugs.ruby-lang.org/issues/18980'
1969
+ Enabled: pending
1970
+ VersionAdded: '1.59'
1971
+
1966
1972
  Lint/LambdaWithoutLiteralBlock:
1967
1973
  Description: 'Checks uses of lambda without a literal block.'
1968
1974
  Enabled: pending
@@ -8,7 +8,7 @@ module RuboCop
8
8
  #
9
9
  # Note: When ``Layout/LineLength``'s `AllowHeredoc` is false (not default),
10
10
  # this cop does not add any offenses for long here documents to
11
- # avoid `Layout/LineLength`'s offenses.
11
+ # avoid ``Layout/LineLength``'s offenses.
12
12
  #
13
13
  # @example
14
14
  # # bad
@@ -62,6 +62,7 @@ module RuboCop
62
62
 
63
63
  register_offense(node)
64
64
  end
65
+ alias on_csend on_send
65
66
 
66
67
  private
67
68
 
@@ -135,7 +136,7 @@ module RuboCop
135
136
  .gsub(/" *\\\n\s*'/, %q(" + ')) # Double quote, backslash, and then single quote
136
137
  .gsub(/' *\\\n\s*"/, %q(' + ")) # Single quote, backslash, and then double quote
137
138
  .gsub(/(["']) *\\\n\s*\1/, '') # Double or single quote, backslash, then same quote
138
- .gsub(/\n\s*(?=\.\w)/, '') # Extra space within method chaining
139
+ .gsub(/\n\s*(?=(&)?\.\w)/, '') # Extra space within method chaining which includes `&.`
139
140
  .gsub(/\s*\\?\n\s*/, ' ') # Any other line break, with or without backslash
140
141
  end
141
142
 
@@ -33,6 +33,7 @@ module RuboCop
33
33
  range = offending_range(node)
34
34
  add_offense(range) { |corrector| corrector.insert_before(range, "\n") } if range
35
35
  end
36
+ alias on_csend on_send
36
37
 
37
38
  private
38
39
 
@@ -6,10 +6,10 @@ module RuboCop
6
6
  # Checks for places where binary operator has identical operands.
7
7
  #
8
8
  # It covers arithmetic operators: `-`, `/`, `%`;
9
- # comparison operators: `==`, `===`, `=~`, `>`, `>=`, `<`, `<=`;
9
+ # comparison operators: `==`, `===`, `=~`, `>`, `>=`, `<`, ``<=``;
10
10
  # bitwise operators: `|`, `^`, `&`;
11
11
  # boolean operators: `&&`, `||`
12
- # and "spaceship" operator - `<=>`.
12
+ # and "spaceship" operator - ``<=>``.
13
13
  #
14
14
  # Simple arithmetic operations are allowed by this cop: `+`, `*`, `**`, `<<` and `>>`.
15
15
  # Although these can be rewritten in a different way, it should not be necessary to
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Lint
6
- # Checks for overwriting an exception with an exception result by use `rescue =>`.
6
+ # Checks for overwriting an exception with an exception result by use ``rescue =>``.
7
7
  #
8
8
  # You intended to write as `rescue StandardError`.
9
9
  # However, you have written `rescue => StandardError`.
@@ -35,12 +35,13 @@ module RuboCop
35
35
 
36
36
  # @!method id_as_hash_key?(node)
37
37
  def_node_matcher :id_as_hash_key?, <<~PATTERN
38
- (send _ {:key? :has_key? :fetch :[] :[]=} (send _ :object_id) ...)
38
+ (call _ {:key? :has_key? :fetch :[] :[]=} (send _ :object_id) ...)
39
39
  PATTERN
40
40
 
41
41
  def on_send(node)
42
42
  add_offense(node) if id_as_hash_key?(node)
43
43
  end
44
+ alias on_csend on_send
44
45
  end
45
46
  end
46
47
  end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Lint
6
+ # Emulates the following Ruby warning in Ruby 3.3.
7
+ #
8
+ # [source,ruby]
9
+ # ----
10
+ # $ ruby -e '0.times { it }'
11
+ # -e:1: warning: `it` calls without arguments will refer to the first block param in Ruby 3.4;
12
+ # use it() or self.it
13
+ # ----
14
+ #
15
+ # `it` calls without arguments will refer to the first block param in Ruby 3.4.
16
+ # So use `it()` or `self.it` to ensure compatibility.
17
+ #
18
+ # @example
19
+ #
20
+ # # bad
21
+ # do_something { it }
22
+ #
23
+ # # good
24
+ # do_something { it() }
25
+ # do_something { self.it }
26
+ #
27
+ class ItWithoutArgumentsInBlock < Base
28
+ include NodePattern::Macros
29
+
30
+ MSG = '`it` calls without arguments will refer to the first block param in Ruby 3.4; ' \
31
+ 'use `it()` or `self.it`.'
32
+
33
+ def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler
34
+ return unless (body = node.body)
35
+ return unless node.arguments.empty_and_without_delimiters?
36
+
37
+ if body.send_type? && deprecated_it_method?(body)
38
+ add_offense(body)
39
+ else
40
+ body.each_descendant(:send).each do |send_node|
41
+ next unless deprecated_it_method?(send_node)
42
+
43
+ add_offense(send_node)
44
+ end
45
+ end
46
+ end
47
+
48
+ def deprecated_it_method?(node)
49
+ return false unless node.method?(:it)
50
+
51
+ !node.receiver && node.arguments.empty? && !node.parenthesized? && !node.block_literal?
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -41,9 +41,9 @@ module RuboCop
41
41
  next unless asgn_node.loc.operator
42
42
 
43
43
  rhs = asgn_node.to_a.last
44
- next unless rhs.respond_to?(:literal?) && rhs.literal?
44
+ next if !forbidden_literal?(rhs) || parallel_assignment_with_splat_operator?(rhs)
45
45
 
46
- range = asgn_node.loc.operator.join(rhs.source_range.end)
46
+ range = offense_range(asgn_node, rhs)
47
47
 
48
48
  add_offense(range, message: format(MSG, literal: rhs.source))
49
49
  end
@@ -58,6 +58,20 @@ module RuboCop
58
58
 
59
59
  node.each_child_node { |child| traverse_node(child, &block) }
60
60
  end
61
+
62
+ def forbidden_literal?(node)
63
+ return false if node.dstr_type? || node.xstr_type?
64
+
65
+ node.respond_to?(:literal?) && node.literal?
66
+ end
67
+
68
+ def parallel_assignment_with_splat_operator?(node)
69
+ node.array_type? && node.values.first&.splat_type?
70
+ end
71
+
72
+ def offense_range(asgn_node, rhs)
73
+ asgn_node.loc.operator.join(rhs.source_range.end)
74
+ end
61
75
  end
62
76
  end
63
77
  end
@@ -34,35 +34,20 @@ module RuboCop
34
34
  add_offense(void_next) if void_next
35
35
  end
36
36
  end
37
-
38
- def on_numblock(node)
39
- on_numblock_body_of_reduce(node) do |body|
40
- void_next = body.each_node(:next).find do |n|
41
- n.children.empty? && parent_numblock_node(n) == node
42
- end
43
-
44
- add_offense(void_next) if void_next
45
- end
46
- end
37
+ alias on_numblock on_block
47
38
 
48
39
  private
49
40
 
50
41
  # @!method on_block_body_of_reduce(node)
51
42
  def_node_matcher :on_block_body_of_reduce, <<~PATTERN
52
- (block (send _recv {:reduce :inject} !sym) _blockargs $(begin ...))
53
- PATTERN
54
-
55
- # @!method on_numblock_body_of_reduce(node)
56
- def_node_matcher :on_numblock_body_of_reduce, <<~PATTERN
57
- (numblock (send _recv {:reduce :inject} !sym) _argscount $(begin ...))
43
+ {
44
+ (block (call _recv {:reduce :inject} !sym) _blockargs $(begin ...))
45
+ (numblock (call _recv {:reduce :inject} !sym) _argscount $(begin ...))
46
+ }
58
47
  PATTERN
59
48
 
60
49
  def parent_block_node(node)
61
- node.each_ancestor(:block).first
62
- end
63
-
64
- def parent_numblock_node(node)
65
- node.each_ancestor(:numblock).first
50
+ node.each_ancestor(:block, :numblock).first
66
51
  end
67
52
  end
68
53
  end
@@ -9,7 +9,7 @@ module RuboCop
9
9
  #
10
10
  # Conversion with `Integer`, `Float`, etc. will raise an `ArgumentError`
11
11
  # if given input that is not numeric (eg. an empty string), whereas
12
- # `to_i`, etc. will try to convert regardless of input (`''.to_i => 0`).
12
+ # `to_i`, etc. will try to convert regardless of input (``''.to_i => 0``).
13
13
  # As such, this cop is disabled by default because it's not necessarily
14
14
  # always correct to raise if a value is not numeric.
15
15
  #
@@ -91,19 +91,24 @@ module RuboCop
91
91
 
92
92
  # @!method to_method(node)
93
93
  def_node_matcher :to_method, <<~PATTERN
94
- (send $_ ${#{METHODS}})
94
+ (call $_ ${#{METHODS}})
95
95
  PATTERN
96
96
 
97
97
  # @!method to_method_symbol(node)
98
98
  def_node_matcher :to_method_symbol, <<~PATTERN
99
- {(send _ $_ ${(sym ${#{METHODS}})} ...)
100
- (send _ $_ ${(block_pass (sym ${#{METHODS}}))} ...)}
99
+ (call _ $_ ${
100
+ {
101
+ (sym ${#{METHODS}})
102
+ (block_pass (sym ${#{METHODS}}))
103
+ }
104
+ } ...)
101
105
  PATTERN
102
106
 
103
107
  def on_send(node)
104
108
  handle_conversion_method(node)
105
109
  handle_as_symbol(node)
106
110
  end
111
+ alias on_csend on_send
107
112
 
108
113
  private
109
114
 
@@ -56,10 +56,10 @@ module RuboCop
56
56
  def_node_matcher :redundant_with_index?, <<~PATTERN
57
57
  {
58
58
  (block
59
- $(send _ {:each_with_index :with_index} ...)
59
+ $(call _ {:each_with_index :with_index} ...)
60
60
  (args (arg _)) ...)
61
61
  (numblock
62
- $(send _ {:each_with_index :with_index} ...) 1 ...)
62
+ $(call _ {:each_with_index :with_index} ...) 1 ...)
63
63
  }
64
64
  PATTERN
65
65
 
@@ -56,9 +56,9 @@ module RuboCop
56
56
  def_node_matcher :redundant_with_object?, <<~PATTERN
57
57
  {
58
58
  (block
59
- $(send _ {:each_with_object :with_object} _) (args (arg _)) ...)
59
+ $(call _ {:each_with_object :with_object} _) (args (arg _)) ...)
60
60
  (numblock
61
- $(send _ {:each_with_object :with_object} _) 1 ...)
61
+ $(call _ {:each_with_object :with_object} _) 1 ...)
62
62
  }
63
63
  PATTERN
64
64
 
@@ -102,6 +102,7 @@ module RuboCop
102
102
 
103
103
  def handle_attribute_assignment(node)
104
104
  first_argument = node.first_argument
105
+ return unless first_argument.respond_to?(:arguments) && first_argument.arguments.empty?
105
106
 
106
107
  if first_argument.call_type? &&
107
108
  node.receiver == first_argument.receiver &&
@@ -69,8 +69,8 @@ module RuboCop
69
69
  # @!method reduce_with_block?(node)
70
70
  def_node_matcher :reduce_with_block?, <<~PATTERN
71
71
  {
72
- (block (send _recv {:reduce :inject} ...) args ...)
73
- (numblock (send _recv {:reduce :inject} ...) ...)
72
+ (block (call _recv {:reduce :inject} ...) args ...)
73
+ (numblock (call _recv {:reduce :inject} ...) ...)
74
74
  }
75
75
  PATTERN
76
76
 
@@ -4,7 +4,7 @@ module RuboCop
4
4
  module Cop
5
5
  module Lint
6
6
  # Checks for uses of `Integer#times` that will never yield
7
- # (when the integer <= 0) or that will only ever yield once
7
+ # (when the integer ``<= 0``) or that will only ever yield once
8
8
  # (`1.times`).
9
9
  #
10
10
  # @safety
@@ -10,9 +10,9 @@ module RuboCop
10
10
  #
11
11
  # Interpreting ABC size:
12
12
  #
13
- # * <= 17 satisfactory
14
- # * 18..30 unsatisfactory
15
- # * > 30 dangerous
13
+ # * ``<= 17`` satisfactory
14
+ # * `18..30` unsatisfactory
15
+ # * `>` 30 dangerous
16
16
  #
17
17
  # You can have repeated "attributes" calls count as a single "branch".
18
18
  # For this purpose, attributes are any method with no argument; no attempt
@@ -61,8 +61,7 @@ module RuboCop
61
61
  end
62
62
 
63
63
  def allowed_method_call_on_rhs?(node)
64
- node&.send_type? &&
65
- (node.receiver.nil? || !literal_receiver?(node))
64
+ node&.send_type? && (node.receiver.nil? || !literal_receiver?(node))
66
65
  end
67
66
 
68
67
  # @!method literal_receiver?(node)
@@ -4,7 +4,7 @@ module RuboCop
4
4
  module Cop
5
5
  module Style
6
6
  # Identifies usages of `arr[0]` and `arr[-1]` and suggests to change
7
- # them to use `arr.first` and `arr.instead`.
7
+ # them to use `arr.first` and `arr.last` instead.
8
8
  #
9
9
  # The cop is disabled by default due to safety concerns.
10
10
  #
@@ -40,6 +40,7 @@ module RuboCop
40
40
  corrector.replace(node.loc.selector, replacement)
41
41
  end
42
42
  end
43
+ alias on_csend on_send
43
44
 
44
45
  def message(node)
45
46
  if node.method?(:is_a?)
@@ -53,7 +53,7 @@ module RuboCop
53
53
 
54
54
  # @!method reject_method_with_block_pass?(node)
55
55
  def_node_matcher :reject_method_with_block_pass?, <<~PATTERN
56
- (send !nil? {:reject :delete_if :reject!}
56
+ (call !nil? {:reject :delete_if :reject!}
57
57
  (block_pass
58
58
  (sym :nil?)))
59
59
  PATTERN
@@ -61,21 +61,21 @@ module RuboCop
61
61
  # @!method reject_method?(node)
62
62
  def_node_matcher :reject_method?, <<~PATTERN
63
63
  (block
64
- (send
64
+ (call
65
65
  !nil? {:reject :delete_if :reject!})
66
66
  $(args ...)
67
- (send
67
+ (call
68
68
  $(lvar _) :nil?))
69
69
  PATTERN
70
70
 
71
71
  # @!method select_method?(node)
72
72
  def_node_matcher :select_method?, <<~PATTERN
73
73
  (block
74
- (send
74
+ (call
75
75
  !nil? {:select :select!})
76
76
  $(args ...)
77
- (send
78
- (send
77
+ (call
78
+ (call
79
79
  $(lvar _) :nil?) :!))
80
80
  PATTERN
81
81
 
@@ -91,6 +91,7 @@ module RuboCop
91
91
 
92
92
  add_offense(range, message: message) { |corrector| corrector.replace(range, good) }
93
93
  end
94
+ alias on_csend on_send
94
95
 
95
96
  private
96
97
 
@@ -105,6 +105,17 @@ module RuboCop
105
105
  def combine_with_left_sibling(corrector, node)
106
106
  corrector.remove(node.left_sibling.body.source_range.end.join(node.left_sibling.loc.end))
107
107
  corrector.remove(node.source_range.begin.join(node.body.source_range.begin))
108
+
109
+ correct_end_of_block(corrector, node)
110
+ end
111
+
112
+ def correct_end_of_block(corrector, node)
113
+ return unless node.left_sibling.respond_to?(:braces?)
114
+ return if node.right_sibling&.block_type? || node.right_sibling&.numblock_type?
115
+
116
+ end_of_block = node.left_sibling.braces? ? '}' : ' end'
117
+ corrector.remove(node.loc.end)
118
+ corrector.insert_before(node.source_range.end, end_of_block)
108
119
  end
109
120
  end
110
121
  end
@@ -63,6 +63,7 @@ module RuboCop
63
63
  end
64
64
  end
65
65
  # rubocop:enable Metrics
66
+ alias on_csend on_send
66
67
 
67
68
  private
68
69
 
@@ -49,12 +49,12 @@ module RuboCop
49
49
  class DateTime < Base
50
50
  extend AutoCorrector
51
51
 
52
- CLASS_MSG = 'Prefer Time over DateTime.'
53
- COERCION_MSG = 'Do not use #to_datetime.'
52
+ CLASS_MSG = 'Prefer `Time` over `DateTime`.'
53
+ COERCION_MSG = 'Do not use `#to_datetime`.'
54
54
 
55
55
  # @!method date_time?(node)
56
56
  def_node_matcher :date_time?, <<~PATTERN
57
- (send (const {nil? (cbase)} :DateTime) ...)
57
+ (call (const {nil? (cbase)} :DateTime) ...)
58
58
  PATTERN
59
59
 
60
60
  # @!method historic_date?(node)
@@ -64,7 +64,7 @@ module RuboCop
64
64
 
65
65
  # @!method to_datetime?(node)
66
66
  def_node_matcher :to_datetime?, <<~PATTERN
67
- (send _ :to_datetime)
67
+ (call _ :to_datetime)
68
68
  PATTERN
69
69
 
70
70
  def on_send(node)
@@ -75,6 +75,7 @@ module RuboCop
75
75
 
76
76
  add_offense(node, message: message) { |corrector| autocorrect(corrector, node) }
77
77
  end
78
+ alias on_csend on_send
78
79
 
79
80
  private
80
81
 
@@ -58,12 +58,12 @@ module RuboCop
58
58
 
59
59
  # @!method each_with_object_block_candidate?(node)
60
60
  def_node_matcher :each_with_object_block_candidate?, <<~PATTERN
61
- (block $(send _ {:inject :reduce} _) $_ $_)
61
+ (block $(call _ {:inject :reduce} _) $_ $_)
62
62
  PATTERN
63
63
 
64
64
  # @!method each_with_object_numblock_candidate?(node)
65
65
  def_node_matcher :each_with_object_numblock_candidate?, <<~PATTERN
66
- (numblock $(send _ {:inject :reduce} _) 2 $_)
66
+ (numblock $(call _ {:inject :reduce} _) 2 $_)
67
67
  PATTERN
68
68
 
69
69
  def autocorrect_block(corrector, node, return_value)
@@ -30,7 +30,7 @@ module RuboCop
30
30
 
31
31
  # @!method exact_regexp_match(node)
32
32
  def_node_matcher :exact_regexp_match, <<~PATTERN
33
- (send
33
+ (call
34
34
  _ {:=~ :=== :!~ :match :match?}
35
35
  (regexp
36
36
  (str $_)
@@ -49,6 +49,7 @@ module RuboCop
49
49
  corrector.replace(node, prefer)
50
50
  end
51
51
  end
52
+ alias on_csend on_send
52
53
 
53
54
  private
54
55
 
@@ -58,18 +58,20 @@ module RuboCop
58
58
 
59
59
  # rubocop:disable Metrics/AbcSize
60
60
  def on_block(node)
61
+ return unless handleable?(node)
62
+
61
63
  kv_each(node) do |target, method|
62
64
  register_kv_offense(target, method) and return
63
65
  end
64
66
 
65
67
  return unless (key, value = each_arguments(node))
66
68
 
67
- if unused_block_arg_exist?(node, value.source)
69
+ if unused_block_arg_exist?(node, value)
68
70
  message = message('each_key', node.method_name, value.source)
69
71
  unused_range = key.source_range.end.join(value.source_range.end)
70
72
 
71
73
  register_each_args_offense(node, message, 'each_key', unused_range)
72
- elsif unused_block_arg_exist?(node, key.source)
74
+ elsif unused_block_arg_exist?(node, key)
73
75
  message = message('each_value', node.method_name, key.source)
74
76
  unused_range = key.source_range.begin.join(value.source_range.begin)
75
77
 
@@ -88,6 +90,12 @@ module RuboCop
88
90
 
89
91
  private
90
92
 
93
+ def handleable?(node)
94
+ return false unless (root_receiver = root_receiver(node))
95
+
96
+ !root_receiver.literal? || root_receiver.hash_type?
97
+ end
98
+
91
99
  def register_kv_offense(target, method)
92
100
  return unless (parent_receiver = target.receiver.receiver)
93
101
  return if allowed_receiver?(parent_receiver)
@@ -99,8 +107,16 @@ module RuboCop
99
107
  end
100
108
  end
101
109
 
102
- def unused_block_arg_exist?(node, block_arg_source)
103
- node.body.each_descendant(:lvar).map(&:source).none?(block_arg_source)
110
+ def unused_block_arg_exist?(node, block_arg)
111
+ lvar_sources = node.body.each_descendant(:lvar).map(&:source)
112
+
113
+ if block_arg.mlhs_type?
114
+ block_arg.each_descendant(:arg).all? do |block_arg|
115
+ lvar_sources.none?(block_arg.source)
116
+ end
117
+ else
118
+ lvar_sources.none?(block_arg.source)
119
+ end
104
120
  end
105
121
 
106
122
  def message(prefer, method_name, unused_code)
@@ -127,6 +143,15 @@ module RuboCop
127
143
  end
128
144
  end
129
145
 
146
+ def root_receiver(node)
147
+ receiver = node.receiver
148
+ if receiver&.receiver
149
+ root_receiver(receiver)
150
+ else
151
+ receiver
152
+ end
153
+ end
154
+
130
155
  def format_message(method_name, current)
131
156
  format(MSG, prefer: "each_#{method_name[0..-2]}", current: current)
132
157
  end
@@ -43,7 +43,7 @@ module RuboCop
43
43
  # @!method bad_method_with_poro?(node)
44
44
  def_node_matcher :bad_method_with_poro?, <<~PATTERN
45
45
  (block
46
- (send _ _)
46
+ (call _ _)
47
47
  (args
48
48
  $(arg _)
49
49
  (arg _))
@@ -86,6 +86,7 @@ module RuboCop
86
86
  corrector.replace(range, preferred_method)
87
87
  end
88
88
  end
89
+ alias on_csend on_send
89
90
 
90
91
  private
91
92
 
@@ -44,9 +44,9 @@ module RuboCop
44
44
 
45
45
  # @!method map_and_compact?(node)
46
46
  def_node_matcher :map_and_compact?, <<~RUBY
47
- (send
47
+ (call
48
48
  (block
49
- (send _ :map)
49
+ (call _ :map)
50
50
  (args
51
51
  $(arg _))
52
52
  {
@@ -85,6 +85,7 @@ module RuboCop
85
85
  end
86
86
  end
87
87
  end
88
+ alias on_csend on_send
88
89
 
89
90
  private
90
91
 
@@ -68,6 +68,7 @@ module RuboCop
68
68
  removal_range = range_between(to_h.loc.dot.begin_pos, to_h.loc.selector.end_pos)
69
69
 
70
70
  corrector.remove(range_with_surrounding_space(removal_range, side: :left))
71
+ corrector.replace(map.loc.dot, '.') if to_h.dot?
71
72
  corrector.replace(map.loc.selector, 'to_h')
72
73
  end
73
74
  end
@@ -86,6 +86,7 @@ module RuboCop
86
86
 
87
87
  def legitimate_call_with_parentheses?(node) # rubocop:disable Metrics/PerceivedComplexity
88
88
  call_in_literals?(node) ||
89
+ node.parent&.when_type? ||
89
90
  call_with_ambiguous_arguments?(node) ||
90
91
  call_in_logical_operators?(node) ||
91
92
  call_in_optional_arguments?(node) ||
@@ -8,6 +8,9 @@ module RuboCop
8
8
  # This cop can be customized allowed methods with `AllowedMethods`.
9
9
  # By default, there are no methods to allowed.
10
10
  #
11
+ # NOTE: This cop allows the use of `it()` without arguments in blocks,
12
+ # as in `0.times { it() }`, following `Lint/ItWithoutArgumentsInBlock` cop.
13
+ #
11
14
  # @example
12
15
  # # bad
13
16
  # object.some_method()
@@ -30,15 +33,18 @@ module RuboCop
30
33
 
31
34
  MSG = 'Do not use parentheses for method calls with no arguments.'
32
35
 
36
+ # rubocop:disable Metrics/CyclomaticComplexity
33
37
  def on_send(node)
34
38
  return unless !node.arguments? && node.parenthesized?
35
39
  return if ineligible_node?(node)
36
40
  return if default_argument?(node)
37
41
  return if allowed_method_name?(node.method_name)
38
42
  return if same_name_assignment?(node)
43
+ return if parenthesized_it_method_in_block?(node)
39
44
 
40
45
  register_offense(node)
41
46
  end
47
+ # rubocop:enable Metrics/CyclomaticComplexity
42
48
 
43
49
  private
44
50
 
@@ -71,6 +77,20 @@ module RuboCop
71
77
  end
72
78
  end
73
79
 
80
+ # Respects `Lint/ItWithoutArgumentsInBlock` cop and the following Ruby 3.3's warning:
81
+ #
82
+ # $ ruby -e '0.times { begin; it; end }'
83
+ # -e:1: warning: `it` calls without arguments will refer to the first block param in
84
+ # Ruby 3.4; use it() or self.it
85
+ #
86
+ def parenthesized_it_method_in_block?(node)
87
+ return false unless node.method?(:it)
88
+ return false unless (block_node = node.each_ancestor(:block).first)
89
+ return false unless block_node.arguments.empty_and_without_delimiters?
90
+
91
+ !node.receiver && node.arguments.empty? && !node.block_literal?
92
+ end
93
+
74
94
  def any_assignment?(node)
75
95
  node.each_ancestor(*AST::Node::ASSIGNMENTS).any? do |asgn_node|
76
96
  # `obj.method = value` parses as (send ... :method= ...), and will
@@ -66,7 +66,7 @@ module RuboCop
66
66
  end
67
67
 
68
68
  def on_block(node)
69
- return unless node.send_node.send_type? && node.send_node.enumerator_method?
69
+ return unless node.send_node.call_type? && node.send_node.enumerator_method?
70
70
 
71
71
  check(node)
72
72
  end
@@ -4,8 +4,8 @@ module RuboCop
4
4
  module Cop
5
5
  module Style
6
6
  # Checks for redundant dot before operator method call.
7
- # The target operator methods are `|`, `^`, `&`, `<=>`, `==`, `===`, `=~`, `>`, `>=`, `<`,
8
- # `<=`, `<<`, `>>`, `+`, `-`, `*`, `/`, `%`, `**`, `~`, `!`, `!=`, and `!~`.
7
+ # The target operator methods are `|`, `^`, `&`, ``<=>``, `==`, `===`, `=~`, `>`, `>=`, `<`,
8
+ # ``<=``, `<<`, `>>`, `+`, `-`, `*`, `/`, `%`, `**`, `~`, `!`, `!=`, and `!~`.
9
9
  #
10
10
  # @example
11
11
  #
@@ -73,6 +73,7 @@ module RuboCop
73
73
  corrector.remove(offense_range)
74
74
  end
75
75
  end
76
+ alias on_csend on_send
76
77
 
77
78
  private
78
79
 
@@ -47,7 +47,7 @@ module RuboCop
47
47
  # @!method redundant_fetch_block_candidate?(node)
48
48
  def_node_matcher :redundant_fetch_block_candidate?, <<~PATTERN
49
49
  (block
50
- $(send _ :fetch _)
50
+ $(call _ :fetch _)
51
51
  (args)
52
52
  ${nil? #basic_literal? #const_type?})
53
53
  PATTERN
@@ -61,10 +61,10 @@ module RuboCop
61
61
  bad = build_bad_method(send, body)
62
62
 
63
63
  add_offense(range, message: format(MSG, good: good, bad: bad)) do |corrector|
64
- receiver, _, key = send.children
64
+ _, _, key = send.children
65
65
  default_value = body ? body.source : 'nil'
66
66
 
67
- corrector.replace(node, "#{receiver.source}.fetch(#{key.source}, #{default_value})")
67
+ corrector.replace(range, "fetch(#{key.source}, #{default_value})")
68
68
  end
69
69
  end
70
70
  end
@@ -22,9 +22,6 @@ module RuboCop
22
22
  # @!method square_brackets?(node)
23
23
  def_node_matcher :square_brackets?, '(send {(send _recv _msg) str array hash} :[] ...)'
24
24
 
25
- # @!method range_end?(node)
26
- def_node_matcher :range_end?, '^^{irange erange}'
27
-
28
25
  # @!method method_node_and_args(node)
29
26
  def_node_matcher :method_node_and_args, '$(call _recv _msg $...)'
30
27
 
@@ -64,7 +61,8 @@ module RuboCop
64
61
  allowed_ancestor?(node) ||
65
62
  allowed_method_call?(node) ||
66
63
  allowed_multiple_expression?(node) ||
67
- allowed_ternary?(node)
64
+ allowed_ternary?(node) ||
65
+ node.parent&.range_type?
68
66
  end
69
67
 
70
68
  def allowed_ancestor?(node)
@@ -144,7 +142,9 @@ module RuboCop
144
142
  return 'a literal' if disallowed_literal?(begin_node, node)
145
143
  return 'a variable' if node.variable?
146
144
  return 'a constant' if node.const_type?
147
- return 'an expression' if node.lambda_or_proc?
145
+ if node.lambda_or_proc? && (node.braces? || node.send_node.lambda_literal?)
146
+ return 'an expression'
147
+ end
148
148
  return 'an interpolated expression' if interpolation?(begin_node)
149
149
 
150
150
  return if begin_node.chained?
@@ -229,7 +229,6 @@ module RuboCop
229
229
  def method_call_with_redundant_parentheses?(node)
230
230
  return false unless node.call_type?
231
231
  return false if node.prefix_not?
232
- return false if range_end?(node)
233
232
 
234
233
  send_node, args = method_node_and_args(node)
235
234
 
@@ -17,7 +17,8 @@ module RuboCop
17
17
  # protected scope, you cannot send private messages this way.
18
18
  #
19
19
  # Note we allow uses of `self` with operators because it would be awkward
20
- # otherwise.
20
+ # otherwise. Also allows the use of `self.it` without arguments in blocks,
21
+ # as in `0.times { self.it }`, following `Lint/ItWithoutArgumentsInBlock` cop.
21
22
  #
22
23
  # @example
23
24
  #
@@ -107,8 +108,8 @@ module RuboCop
107
108
  def on_send(node)
108
109
  return unless node.self_receiver? && regular_method_call?(node)
109
110
  return if node.parent&.mlhs_type?
110
-
111
111
  return if allowed_send_node?(node)
112
+ return if it_method_in_block?(node)
112
113
 
113
114
  add_offense(node.receiver) do |corrector|
114
115
  corrector.remove(node.receiver)
@@ -155,6 +156,20 @@ module RuboCop
155
156
  KERNEL_METHODS.include?(node.method_name)
156
157
  end
157
158
 
159
+ # Respects `Lint/ItWithoutArgumentsInBlock` cop and the following Ruby 3.3's warning:
160
+ #
161
+ # $ ruby -e '0.times { begin; it; end }'
162
+ # -e:1: warning: `it` calls without arguments will refer to the first block param in
163
+ # Ruby 3.4; use it() or self.it
164
+ #
165
+ def it_method_in_block?(node)
166
+ return false unless node.method?(:it)
167
+ return false unless (block_node = node.each_ancestor(:block).first)
168
+ return false unless block_node.arguments.empty_and_without_delimiters?
169
+
170
+ node.arguments.empty? && !node.block_literal?
171
+ end
172
+
158
173
  def regular_method_call?(node)
159
174
  !(node.operator_method? ||
160
175
  KEYWORDS.include?(node.method_name) ||
@@ -16,7 +16,7 @@ module RuboCop
16
16
  # This cop is unsafe, because `sort...last` and `max` may not return the
17
17
  # same element in all cases.
18
18
  #
19
- # In an enumerable where there are multiple elements where `a <=> b == 0`,
19
+ # In an enumerable where there are multiple elements where ``a <=> b == 0``,
20
20
  # or where the transformation done by the `sort_by` block has the
21
21
  # same result, `sort.last` and `max` (or `sort_by.last` and `max_by`)
22
22
  # will return different elements. `sort.last` will return the last
@@ -87,15 +87,15 @@ module RuboCop
87
87
  # @!method redundant_sort?(node)
88
88
  def_node_matcher :redundant_sort?, <<~MATCHER
89
89
  {
90
- (send $(send _ $:sort) ${:last :first})
91
- (send $(send _ $:sort) ${:[] :at :slice} {(int 0) (int -1)})
90
+ (call $(call _ $:sort) ${:last :first})
91
+ (call $(call _ $:sort) ${:[] :at :slice} {(int 0) (int -1)})
92
92
 
93
- (send $(send _ $:sort_by _) ${:last :first})
93
+ (call $(call _ $:sort_by _) ${:last :first})
94
94
  (send $(send _ $:sort_by _) ${:[] :at :slice} {(int 0) (int -1)})
95
95
 
96
- (send ({block numblock} $(send _ ${:sort_by :sort}) ...) ${:last :first})
97
- (send
98
- ({block numblock} $(send _ ${:sort_by :sort}) ...)
96
+ (call ({block numblock} $(call _ ${:sort_by :sort}) ...) ${:last :first})
97
+ (call
98
+ ({block numblock} $(call _ ${:sort_by :sort}) ...)
99
99
  ${:[] :at :slice} {(int 0) (int -1)}
100
100
  )
101
101
  }
@@ -108,6 +108,7 @@ module RuboCop
108
108
 
109
109
  register_offense(ancestor, sort_node, sorter, accessor)
110
110
  end
111
+ alias on_csend on_send
111
112
 
112
113
  private
113
114
 
@@ -46,12 +46,12 @@ module RuboCop
46
46
 
47
47
  # @!method redundant_sort_by_block(node)
48
48
  def_node_matcher :redundant_sort_by_block, <<~PATTERN
49
- (block $(send _ :sort_by) (args (arg $_x)) (lvar _x))
49
+ (block $(call _ :sort_by) (args (arg $_x)) (lvar _x))
50
50
  PATTERN
51
51
 
52
52
  # @!method redundant_sort_by_numblock(node)
53
53
  def_node_matcher :redundant_sort_by_numblock, <<~PATTERN
54
- (numblock $(send _ :sort_by) 1 (lvar :_1))
54
+ (numblock $(call _ :sort_by) 1 (lvar :_1))
55
55
  PATTERN
56
56
 
57
57
  def sort_by_range(send, node)
@@ -35,7 +35,7 @@ module RuboCop
35
35
 
36
36
  # @!method sample_candidate?(node)
37
37
  def_node_matcher :sample_candidate?, <<~PATTERN
38
- (send $(send _ :shuffle $...) ${:#{RESTRICT_ON_SEND.join(' :')}} $...)
38
+ (call $(call _ :shuffle $...) ${:#{RESTRICT_ON_SEND.join(' :')}} $...)
39
39
  PATTERN
40
40
 
41
41
  def on_send(node)
@@ -52,6 +52,7 @@ module RuboCop
52
52
  end
53
53
  end
54
54
  end
55
+ alias on_csend on_send
55
56
 
56
57
  private
57
58
 
@@ -55,8 +55,8 @@ module RuboCop
55
55
  # @!method regexp_match?(node)
56
56
  def_node_matcher :regexp_match?, <<~PATTERN
57
57
  {
58
- (block send (args (arg $_)) ${(send _ %REGEXP_METHODS _) match-with-lvasgn})
59
- (numblock send $1 ${(send _ %REGEXP_METHODS _) match-with-lvasgn})
58
+ (block call (args (arg $_)) ${(send _ %REGEXP_METHODS _) match-with-lvasgn})
59
+ (numblock call $1 ${(send _ %REGEXP_METHODS _) match-with-lvasgn})
60
60
  }
61
61
  PATTERN
62
62
 
@@ -64,9 +64,9 @@ module RuboCop
64
64
  # @!method creates_hash?(node)
65
65
  def_node_matcher :creates_hash?, <<~PATTERN
66
66
  {
67
- (send (const _ :Hash) {:new :[]} ...)
68
- (block (send (const _ :Hash) :new ...) ...)
69
- (send _ { :to_h :to_hash } ...)
67
+ (call (const _ :Hash) {:new :[]} ...)
68
+ (block (call (const _ :Hash) :new ...) ...)
69
+ (call _ { :to_h :to_hash } ...)
70
70
  }
71
71
  PATTERN
72
72
 
@@ -100,6 +100,7 @@ module RuboCop
100
100
  register_offense(node, block_node, regexp, replacement)
101
101
  end
102
102
  # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
103
+ alias on_csend on_send
103
104
 
104
105
  private
105
106
 
@@ -3,8 +3,11 @@
3
3
  module RuboCop
4
4
  module Cop
5
5
  module Style
6
- # Sometimes using dig method ends up with just a single
7
- # argument. In such cases, dig should be replaced with [].
6
+ # Sometimes using `dig` method ends up with just a single
7
+ # argument. In such cases, dig should be replaced with `[]`.
8
+ #
9
+ # Since replacing `hash&.dig(:key)` with `hash[:key]` could potentially lead to error,
10
+ # calls to the `dig` method using safe navigation will be ignored.
8
11
  #
9
12
  # @safety
10
13
  # This cop is unsafe because it cannot be guaranteed that the receiver
@@ -35,6 +35,7 @@ module RuboCop
35
35
  corrector.replace(range, 'chars')
36
36
  end
37
37
  end
38
+ alias on_csend on_send
38
39
  end
39
40
  end
40
41
  end
@@ -22,20 +22,23 @@ module RuboCop
22
22
 
23
23
  # @!method lstrip_rstrip(node)
24
24
  def_node_matcher :lstrip_rstrip, <<~PATTERN
25
- {(send $(send _ $:rstrip) $:lstrip)
26
- (send $(send _ $:lstrip) $:rstrip)}
25
+ {
26
+ (call $(call _ :rstrip) :lstrip)
27
+ (call $(call _ :lstrip) :rstrip)
28
+ }
27
29
  PATTERN
28
30
 
29
31
  def on_send(node)
30
- lstrip_rstrip(node) do |first_send, method_one, method_two|
32
+ lstrip_rstrip(node) do |first_send|
31
33
  range = range_between(first_send.loc.selector.begin_pos, node.source_range.end_pos)
32
- message = format(MSG, methods: "#{method_one}.#{method_two}")
34
+ message = format(MSG, methods: range.source)
33
35
 
34
36
  add_offense(range, message: message) do |corrector|
35
37
  corrector.replace(range, 'strip')
36
38
  end
37
39
  end
38
40
  end
41
+ alias on_csend on_send
39
42
  end
40
43
  end
41
44
  end
@@ -23,38 +23,35 @@ module RuboCop
23
23
 
24
24
  minimum_target_ruby_version 2.4
25
25
 
26
- MSG = 'Use `%<receiver>s.unpack1(%<format>s)` instead of ' \
27
- '`%<receiver>s.unpack(%<format>s)%<method>s`.'
26
+ MSG = 'Use `unpack1(%<format>s)` instead of `%<current>s`.'
28
27
  RESTRICT_ON_SEND = %i[first [] slice at].freeze
29
28
 
30
29
  # @!method unpack_and_first_element?(node)
31
30
  def_node_matcher :unpack_and_first_element?, <<~PATTERN
32
31
  {
33
- (send $(send (...) :unpack $(...)) :first)
34
- (send $(send (...) :unpack $(...)) {:[] :slice :at} (int 0))
32
+ (call $(call (...) :unpack $(...)) :first)
33
+ (call $(call (...) :unpack $(...)) {:[] :slice :at} (int 0))
35
34
  }
36
35
  PATTERN
37
36
 
38
37
  def on_send(node)
39
38
  unpack_and_first_element?(node) do |unpack_call, unpack_arg|
40
- range = first_element_range(node, unpack_call)
41
- message = format(MSG,
42
- receiver: unpack_call.receiver.source,
43
- format: unpack_arg.source,
44
- method: range.source)
45
- add_offense(node, message: message) do |corrector|
46
- corrector.remove(first_element_range(node, unpack_call))
39
+ first_element_range = first_element_range(node, unpack_call)
40
+ offense_range = unpack_call.loc.selector.join(node.source_range.end)
41
+ message = format(MSG, format: unpack_arg.source, current: offense_range.source)
42
+
43
+ add_offense(offense_range, message: message) do |corrector|
44
+ corrector.remove(first_element_range)
47
45
  corrector.replace(unpack_call.loc.selector, 'unpack1')
48
46
  end
49
47
  end
50
48
  end
49
+ alias on_csend on_send
51
50
 
52
51
  private
53
52
 
54
53
  def first_element_range(node, unpack_call)
55
- Parser::Source::Range.new(node.source_range.source_buffer,
56
- unpack_call.source_range.end_pos,
57
- node.source_range.end_pos)
54
+ unpack_call.source_range.end.join(node.source_range.end)
58
55
  end
59
56
  end
60
57
  end
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  # This module holds the RuboCop version information.
5
5
  module Version
6
- STRING = '1.58.0'
6
+ STRING = '1.59.0'
7
7
 
8
8
  MSG = '%<version>s (using Parser %<parser_version>s, ' \
9
9
  'rubocop-ast %<rubocop_ast_version>s, ' \
data/lib/rubocop.rb CHANGED
@@ -332,6 +332,7 @@ require_relative 'rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler'
332
332
  require_relative 'rubocop/cop/lint/ineffective_access_modifier'
333
333
  require_relative 'rubocop/cop/lint/inherit_exception'
334
334
  require_relative 'rubocop/cop/lint/interpolation_check'
335
+ require_relative 'rubocop/cop/lint/it_without_arguments_in_block'
335
336
  require_relative 'rubocop/cop/lint/lambda_without_literal_block'
336
337
  require_relative 'rubocop/cop/lint/literal_as_condition'
337
338
  require_relative 'rubocop/cop/lint/literal_assignment_in_condition'
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.58.0
4
+ version: 1.59.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
8
8
  - Jonas Arvidsson
9
9
  - Yuji Nakayama
10
- autorequire:
10
+ autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2023-12-01 00:00:00.000000000 Z
13
+ date: 2023-12-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
@@ -467,6 +467,7 @@ files:
467
467
  - lib/rubocop/cop/lint/ineffective_access_modifier.rb
468
468
  - lib/rubocop/cop/lint/inherit_exception.rb
469
469
  - lib/rubocop/cop/lint/interpolation_check.rb
470
+ - lib/rubocop/cop/lint/it_without_arguments_in_block.rb
470
471
  - lib/rubocop/cop/lint/lambda_without_literal_block.rb
471
472
  - lib/rubocop/cop/lint/literal_as_condition.rb
472
473
  - lib/rubocop/cop/lint/literal_assignment_in_condition.rb
@@ -1029,10 +1030,10 @@ metadata:
1029
1030
  homepage_uri: https://rubocop.org/
1030
1031
  changelog_uri: https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
1031
1032
  source_code_uri: https://github.com/rubocop/rubocop/
1032
- documentation_uri: https://docs.rubocop.org/rubocop/1.58/
1033
+ documentation_uri: https://docs.rubocop.org/rubocop/1.59/
1033
1034
  bug_tracker_uri: https://github.com/rubocop/rubocop/issues
1034
1035
  rubygems_mfa_required: 'true'
1035
- post_install_message:
1036
+ post_install_message:
1036
1037
  rdoc_options: []
1037
1038
  require_paths:
1038
1039
  - lib
@@ -1047,8 +1048,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1047
1048
  - !ruby/object:Gem::Version
1048
1049
  version: '0'
1049
1050
  requirements: []
1050
- rubygems_version: 3.4.22
1051
- signing_key:
1051
+ rubygems_version: 3.3.7
1052
+ signing_key:
1052
1053
  specification_version: 4
1053
1054
  summary: Automatic Ruby code style checking tool.
1054
1055
  test_files: []