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/RedundantFetchBlock causes undefined method error. #8227
Comments
richardkmichael
changed the title
Style/RedundantFetchBlock causes Nil node error on Rails master
Style/RedundantFetchBlock causes undefined method error.
Jun 30, 2020
Thanks for reporting this. Will look at it tomorrow, if no one gets ahead of me 😃 . |
I believe this was already fixed by #8197. |
@fatkodima You're welcome. It was brought to my attention in rails/rails#39765, so you might consider bumping your own rails/rails#39527 when fixed so Rails could use it. |
@jonathanhefner Thanks again. :-) It is fast today! |
8 tasks
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am enabling the recent
Style/RedundantFetchBlock
and{}.fetch(:key) { }
(here in Rails) causes an undefined method error.Expected behavior
As with other suggestions to
#fetch()
with a block, Rubocop should suggest the implicitnil
returned by the block:{}.fetch(:key, nil)
Actual behavior
Steps to reproduce the problem
RuboCop version
0.86.0 (using Parser 2.7.1.4, rubocop-ast 0.1.0, running on ruby 2.5.8 x86_64-darwin18)
Presumably related to the helpful cop added in #8147 by @fatkodima (thank you!).
The text was updated successfully, but these errors were encountered: