Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style/ArgumentsForwarding with added arguments on Ruby 3.1 results in an error #12109

Closed
herwinw opened this issue Aug 9, 2023 · 0 comments · Fixed by #12110
Closed

Style/ArgumentsForwarding with added arguments on Ruby 3.1 results in an error #12109

herwinw opened this issue Aug 9, 2023 · 0 comments · Fixed by #12110
Labels

Comments

@herwinw
Copy link

herwinw commented Aug 9, 2023

With the Ruby 3.1 config:

AllCops:
  NewCops: enable
  TargetRubyVersion: 3.1

The following code results in a runtime error:

def foo(**kwargs, &)
  bar(1, **kwargs, &)
end
An error occurred while Style/ArgumentsForwarding cop was inspecting poc.rb:1:0.
undefined method `+' for nil:NilClass

            arg_after_splat = arguments[splat_index + 1]
                                                    ^
vendor/bundle/ruby/3.1.0/gems/rubocop-1.56.0/lib/rubocop/cop/style/arguments_forwarding.rb:336:in `no_post_splat_args?'
[.. more backtrace ...]

RuboCop version

This is a regression in 1.56.0, the same code does not result in crashes in 1.55.1

$ bundle exec rubocop -V
1.56.0 (using Parser 3.2.2.3, rubocop-ast 1.29.0, running on ruby 3.1.2) [x86_64-linux-gnu]
@koic koic added the bug label Aug 9, 2023
ydah added a commit to ydah/rubocop that referenced this issue Aug 9, 2023
… when forwarding kwargs/block arg and an additional arg

Fix: rubocop#12109
koic added a commit that referenced this issue Aug 9, 2023
[Fix: #12109] Fix an error for `Style/ArgumentsForwarding` cop when forwarding kwargs/block arg and an additional arg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants