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 incorrect code length calculations for few more patterns #10543
Fix incorrect code length calculations for few more patterns #10543
Conversation
46653e0
to
355e759
Compare
355e759
to
14fa793
Compare
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.
Nice test coverage. Thank you 🙇
end | ||
|
||
def another_args?(node) | ||
node.send_type? && node.children.count > 3 |
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.
node.send_type? && node.children.count > 3 | |
node.send_type? && node.arguments.count > 1 |
is easier to understand
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.
Also better use call_type?
as it also covers csend (&.) nodes
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.
Thank you, I've updated another_args?
and add a test case.
14fa793
to
476aca5
Compare
Nicely done! Thanks! |
Follow up #10469 and #10520.
This PR improve code length calculation for few more patterns like follows:
Previously, it always subtracted 2 under certain conditions, but now it considers cases where hash begins/ends on the same line as the parentheses or there are other arguments.
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 runs RuboCop on its own code.{change_type}_{change_description}.md
if the new code introduces user-observable changes. See changelog entry format for details.