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
[Fix #7602] Handle Ruby 2.7 forward arguments properly #7605
Conversation
match_with_lvasgn begin kwbegin return | ||
in_match case_match in_pattern match_alt | ||
match_as array_pattern array_pattern_with_tail | ||
hash_pattern const_pattern].freeze |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed that the traversal methods generated via MANY_CHILD_NODES
assume that every child node exists (i.e. is not nil). That is not true for in_pattern
nodes, for example. So we need to review those types more carefully.
3a57b3d
to
7bcc234
Compare
@koic Rebased. |
I'll likely cut a new release tomorrow or on Monday. There are a few more PRs I'd like to include it in. |
Note!
Not ready until we fix this.
Background
In Ruby 2.7, a new argument forwarding syntax was introduced. It looks like this:
This resulted in some unexpected breakage of some of our cops.
What is this fix?
All 2.7 node types have been added to the node traversal class, courtesy of @buehmann.
The biggest change is the introduction of a
ForwardArgsNode
extension. This allows forward arguments to be handled polymorphically with other argument types. This fixes the majority of the errors.Additionally, the
Naming/MethodParameterName
cop has been made aware of forward arguments, so that it does not complain that...
is not a good name.Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and RuboCop for itself, and generates the documentation.