You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixesrubocop#7953.
This PR fixes the following error for `Lint/AmbiguousOperator`
when a method with no arguments is used in advance.
```console
% cat example.rb
foo
bar +1
% bundle exec rubocop --only Lint/AmbiguousOperator -d
(snip)
An error occurred while Lint/AmbiguousOperator cop was inspecting
/Users/koic/src/github.com/koic/rubocop-issues/7953/example.rb.
undefined method `source_range' for nil:NilClass
/Users/koic/src/github.com/rubocop-hq/rubocop/lib/rubocop/cop/lint/ambiguous_operator.rb:75:in
`offense_position?'
/Users/koic/src/github.com/rubocop-hq/rubocop/lib/rubocop/cop/lint/ambiguous_operator.rb:63:in
`block in find_offense_node_by'
```
Fixes#7953.
This PR fixes the following error for `Lint/AmbiguousOperator`
when a method with no arguments is used in advance.
```console
% cat example.rb
foo
bar +1
% bundle exec rubocop --only Lint/AmbiguousOperator -d
(snip)
An error occurred while Lint/AmbiguousOperator cop was inspecting
/Users/koic/src/github.com/koic/rubocop-issues/7953/example.rb.
undefined method `source_range' for nil:NilClass
/Users/koic/src/github.com/rubocop-hq/rubocop/lib/rubocop/cop/lint/ambiguous_operator.rb:75:in
`offense_position?'
/Users/koic/src/github.com/rubocop-hq/rubocop/lib/rubocop/cop/lint/ambiguous_operator.rb:63:in
`block in find_offense_node_by'
```
Hey folks. Thanks for all the work on RuboCop. I ran into this issue testing the engine against our customer code bases.
Expected behavior
RuboCop runs without errors when inspecting:
Actual behavior
The cop fails with this error:
Steps to reproduce the problem
Run rubocop against the above example
RuboCop version
The text was updated successfully, but these errors were encountered: