-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Rails/Delegate ignores ruby 2.3 Safe Nagivation Operator #3040
Comments
@geniou You created that cop. Can you look into this? |
Same thing happens here:
gets converted to |
One gotcha here is that # nil if foo is nil
def foo_id
foo&.id
end
# RuntimeError if foo is nil and whiny nils
delegate :id, to: :foo, prefix: true, allow_nil: true |
The following line of code:
object_that_can_be_nil&.foo
gets converted todelegate :foo, to: :object_that_can_be_nil, prefix: true
which is not equivalent. The equivalent would bedelegate :foo, to: :object_that_can_be_nil, prefix: true, allow_nil: true
.This all happens in rubocop 0.39.0 and parameter
auto-correct
enabled.The text was updated successfully, but these errors were encountered: