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

Performance/AncestorsInclude with auto correct raises error #147

Closed
aglushkov opened this issue Jul 9, 2020 · 0 comments · Fixed by #148
Closed

Performance/AncestorsInclude with auto correct raises error #147

aglushkov opened this issue Jul 9, 2020 · 0 comments · Fixed by #148
Labels
bug Something isn't working

Comments

@aglushkov
Copy link

Performance/AncestorsInclude with auto correct raises error

Steps to reproduce the problem

Add <file> with text ancestors.include?(SomeClass)
Check it with rubocop <file> --auto-correct --debug

Output includes error:

An error occurred while Performance/AncestorsInclude cop was inspecting <file>:1:0.
undefined method `source' for nil:NilClass
~/rubocop-performance-1.7.0/lib/rubocop/cop/performance/ancestors_include.rb:38:in `block (2 levels) in autocorrect'
~/rubocop-0.87.1/lib/rubocop/cop/cop.rb:134:in `block in emulate_v0_callsequence'
~/rubocop-0.87.1/lib/rubocop/cop/cop.rb:154:in `suppress_clobbering'
~/rubocop-0.87.1/lib/rubocop/cop/cop.rb:133:in `emulate_v0_callsequence'
~/rubocop-0.87.1/lib/rubocop/cop/cop.rb:34:in `block in add_offense'
~/rubocop-0.87.1/lib/rubocop/cop/base.rb:302:in `correct'
~/rubocop-0.87.1/lib/rubocop/cop/base.rb:115:in `add_offense'
~/rubocop-0.87.1/lib/rubocop/cop/cop.rb:33:in `add_offense'

RuboCop version

rubocop -V
0.87.1 (using Parser 2.7.1.4, rubocop-ast 0.1.0, running on ruby 2.6.6 x86_64-linux)
@koic koic added the bug Something isn't working label Jul 9, 2020
koic added a commit to koic/rubocop-performance that referenced this issue Jul 9, 2020
Fixes rubocop#147.

This PR fixes an error for `Performance/AncestorsInclude`
when using `ancestors.include? without receiver.
koic added a commit to koic/rubocop-performance that referenced this issue Jul 9, 2020
Fixes rubocop#147.

This PR fixes an error for `Performance/AncestorsInclude`
when using `ancestors.include?` without receiver.
koic added a commit to koic/rubocop-performance that referenced this issue Jul 11, 2020
Fixes rubocop#147.

This PR fixes an error for `Performance/AncestorsInclude`
when using `ancestors.include?` without receiver.
@koic koic closed this as completed in #148 Jul 11, 2020
koic added a commit that referenced this issue Jul 11, 2020
…_include

[Fix #147] Fix an error for `Performance/AncestorsInclude`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants