rubocop-ast 1.38.0 → 1.38.1

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: 3a3205a51f90d1dc493ef4c1ec96a4f40ed796dfc58bfc3661db72e67e134abc
4
- data.tar.gz: 6d55fec1f58d712845ecb936db794934ea264e64b0adeb2c097fae63a5e5cb3e
3
+ metadata.gz: c7fd9852873f22808386ddc6962f7373509ec03930f3e5c667475d512480b705
4
+ data.tar.gz: b6d36926cd045b8486679af378d1fdd21875b941d3f5916fbb6876f04ef75e11
5
5
  SHA512:
6
- metadata.gz: 9468ab39ad7cd4ca56f0781605f07136dc89dfcbafc51482d5045799b468bf389d3c61671f49c7242f3dfbcc99090f3bd4b0c178d08b6038818b0158e3078658
7
- data.tar.gz: a5b2b0604abdd935bfba3213a908678b5697cee7345f5b9941bfdddbfc08ceb8e86cab35895490f2612fd71937baa2ff5b7d75bb2ee4dafb5efd656178dc00c1
6
+ metadata.gz: b83bb3a5b3c20a8831d6ad8e075d536b3ff8042d873ce6062161fbe1556e80da5fc4646499dc0432864ecb034ffe3ade83f7ac2f37562a9df22620b486e61e5a
7
+ data.tar.gz: d6f98f800797330d515911991c9215e8fa616cdcde7a73666aa0d25ff05b70b9274a1f0df689f8a820a6573c391bca487100a258a142c21a60f3fd8ea6e5c5e8
@@ -20,7 +20,7 @@ module RuboCop
20
20
  # @return [Array<Symbol>] names of all the variables being assigned
21
21
  def names
22
22
  assignments.map do |assignment|
23
- if assignment.send_type? || assignment.indexasgn_type?
23
+ if assignment.type?(:send, :indexasgn)
24
24
  assignment.method_name
25
25
  else
26
26
  assignment.name
@@ -99,7 +99,9 @@ module RuboCop
99
99
 
100
100
  def valid_argument_types?
101
101
  [first, second].all? do |argument|
102
+ # rubocop:disable InternalAffairs/NodeTypeMultiplePredicates
102
103
  argument.pair_type? || argument.kwsplat_type?
104
+ # rubocop:enable InternalAffairs/NodeTypeMultiplePredicates
103
105
  end
104
106
  end
105
107
 
@@ -201,7 +201,7 @@ module RuboCop
201
201
 
202
202
  return unless node.send_type? && node.receiver.nil? && arg.is_a?(::AST::Node)
203
203
 
204
- return arg if arg.def_type? || arg.defs_type?
204
+ return arg if arg.type?(:def, :defs)
205
205
 
206
206
  def_modifier(arg)
207
207
  end
@@ -57,7 +57,7 @@ module RuboCop
57
57
  # @return [Boolean] whether the last argument of the node is a block pass
58
58
  def block_argument?
59
59
  arguments? &&
60
- (last_argument.block_pass_type? || last_argument.blockarg_type?)
60
+ last_argument.type?(:block_pass, :blockarg)
61
61
  end
62
62
 
63
63
  # A specialized `ParameterizedNode` for node that have a single child
@@ -5,11 +5,22 @@ module RuboCop
5
5
  module SimpleForwardable
6
6
  def def_delegators(accessor, *methods)
7
7
  methods.each do |method|
8
- class_eval(<<~RUBY, __FILE__, __LINE__ + 1)
9
- def #{method}(...) # def example(...)
10
- #{accessor}.#{method}(...) # foo.example(...)
11
- end # end
12
- RUBY
8
+ if method.end_with?('=') && method.to_s != '[]='
9
+ # Defining a delegator for `foo=` can't use `foo=(...)` because it is a
10
+ # syntax error. Fall back to doing a slower `public_send` instead.
11
+ # TODO: Use foo(method, ...) when Ruby 3.1 is required.
12
+ class_eval(<<~RUBY, __FILE__, __LINE__ + 1)
13
+ def #{method}(*args, **kwargs, &blk) # def example=(*args, **kwargs, &blk)
14
+ #{accessor}.public_send(:#{method}, *args, **kwargs, &blk) # foo.public_send(:example=, *args, **kwargs, &blk)
15
+ end # end
16
+ RUBY
17
+ else
18
+ class_eval(<<~RUBY, __FILE__, __LINE__ + 1)
19
+ def #{method}(...) # def example(...)
20
+ #{accessor}.#{method}(...) # foo.example(...)
21
+ end # end
22
+ RUBY
23
+ end
13
24
  end
14
25
  end
15
26
  end
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module AST
5
5
  module Version
6
- STRING = '1.38.0'
6
+ STRING = '1.38.1'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-ast
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.38.0
4
+ version: 1.38.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2025-01-27 00:00:00.000000000 Z
13
+ date: 2025-02-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: parser