Skip to content
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

Safe Navigation Consistency: undefined method `type' for nil:NilClass #5791

Closed
swrobel opened this issue Apr 16, 2018 · 0 comments · Fixed by #5792
Closed

Safe Navigation Consistency: undefined method `type' for nil:NilClass #5791

swrobel opened this issue Apr 16, 2018 · 0 comments · Fixed by #5792

Comments

@swrobel
Copy link
Contributor

swrobel commented Apr 16, 2018

Expected behavior

The cop should pass

Actual behavior

An error occurred while Lint/SafeNavigationConsistency cop was inspecting <file>
undefined method `type' for nil:NilClass
vendor/bundle/gems/rubocop-0.55.0/lib/rubocop/cop/lint/safe_navigation_consistency.rb:72:in `top_conditional_ancestor'
vendor/bundle/gems/rubocop-0.55.0/lib/rubocop/cop/lint/safe_navigation_consistency.rb:75:in `top_conditional_ancestor'
vendor/bundle/gems/rubocop-0.55.0/lib/rubocop/cop/lint/safe_navigation_consistency.rb:40:in `check'
vendor/bundle/gems/rubocop-0.55.0/lib/rubocop/cop/lint/safe_navigation_consistency.rb:36:in `on_csend'

Steps to reproduce the problem

Failing spec, which is a bit contrived, but illustrates the same failure that I get in my project's code with a more complex line: swrobel@12ba988

RuboCop version

$ rubocop -V
0.55.0 (using Parser 2.5.1.0, running on ruby 2.5.1 x86_64-darwin17)

cc @rrosenblum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant