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

Forward all arguments with Style/ArgumentsForwarding #10090

Closed
teoljungberg opened this issue Sep 16, 2021 · 2 comments · Fixed by #10091
Closed

Forward all arguments with Style/ArgumentsForwarding #10090

teoljungberg opened this issue Sep 16, 2021 · 2 comments · Fixed by #10091
Labels

Comments

@teoljungberg
Copy link

We have uses of *args and **args being forwarded in our codebase. They occur like

def self.call(*args)
  new(*args).call
end

or

def self.call(**args)
  new(**args).call
end

I ideally want them to both be collapsed into

def self.call(...)
  new(...).call
end

I wanted to enable Style/ArgumentsForwarding to prefer using ... instead, however, I found that enabling Style/ArgumentsForwarding did not catch replacing *args with .... I then tried it with the configuration option AllowOnlyRestArgument: false on the cop and then *args are suggested to be replaced with ....

I could not find an option that suggests replacing **args with ....

@koic koic added the bug label Sep 16, 2021
koic added a commit to koic/rubocop that referenced this issue Sep 16, 2021
Fixes rubocop#10090.

This PR fixes a false negative for `Style/ArgumentsForwarding`
when using only kwrest arg.
koic added a commit that referenced this issue Sep 19, 2021
…ments_forwarding

[Fix #10090] Fix a false negative for `Style/ArgumentsForwarding`
@teoljungberg
Copy link
Author

Thank you @koic

@koic
Copy link
Member

koic commented Sep 19, 2021

Thank you for the feedback @teoljungberg!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants