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
Allow chained Hash#[] when BlockDelimiters braces_for_chaining is true #6847
Allow chained Hash#[] when BlockDelimiters braces_for_chaining is true #6847
Conversation
This doesn't work for the case,
Maybe someone with more knowledge of the AST could point me in the right direction for fixing this. |
7b8a698
to
2b566bc
Compare
|
Is anyone able to look at this? I'm pretty sure this is a bug. My company has been using this for some time with no issues. |
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.
The change looks good to me. 🙇
@att14 Sorry about the slow response - huge backlog of other tasks... :-( Rebase and add a changelog entry and we're good to go. |
h.key?(:foo) | ||
}[:foo] | ||
RUBY | ||
expect_no_offenses(<<-RUBY.strip_indent) |
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.
This example doesn't match the it
description. In general I'd have one it per example.
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.
👌
fa5cb7f
to
c6e28d2
Compare
…hen `braces_for_chaining` is set.
c6e28d2
to
2466225
Compare
Any ideas on why the 2.2 build is failing? |
Seems that the newest version of byebug dropped support for Ruby 2.2. |
👍 thank you! |
Sometimes the return of a block is a Hash and Ruby allows you to call
[]
without a dot. This means only checkingdot?
inreturn_value_chaining?
does not allow chaining Hash element reference. I wasn't sure if checking the explicit method name was the best choice or if there is something that I missed in the documentation.I did not add an entry to the Changelog in order to get feedback first. If this is an acceptable change I will do so.
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).and description in grammatically correct, complete sentences.
bundle exec rake default
. It executes all tests and RuboCop for itself, and generates the documentation.