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
The following error message is printed when processing an otherwise perfectly valid Ruby file:
1 error occurred:
An error occurred while Style/SwapValues cop was inspecting /private/tmp/rubocop/bug.rb:3:5.
Errors are usually caused by RuboCop bugs.
Please, report your problems to RuboCop's issue tracker.
https://github.com/rubocop/rubocop/issues
This appears to be caused - after a bit of digging - by the following exception:
An error occurred while Style/SwapValues cop was inspecting /private/tmp/rubocop/bug.rb:3:5.
undefined method `type' for :do_it:Symbol
/usr/local/var/rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/rubocop-1.25.0/lib/rubocop/cop/style/swap_values.rb:61:in `simple_assignment?'
/usr/local/var/rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/rubocop-1.25.0/lib/rubocop/cop/style/swap_values.rb:53:in `swapping_values?'
/usr/local/var/rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/rubocop-1.25.0/lib/rubocop/cop/style/swap_values.rb:35:in `on_asgn'
...
> rubocop --only Style/SwapValues bug.rb
An error occurred while Style/SwapValues cop was inspecting /private/tmp/rubocop/bug.rb:3:5.
To see the complete backtrace run rubocop -d.
Inspecting 1 file
An error occurred while Style/SwapValues cop was inspecting /private/tmp/rubocop/bug.rb:3:5.
To see the complete backtrace run rubocop -d.
.
1 file inspected, no offenses detected
...
> _
Steps to reproduce the problem
create a file named bug.rb with the above content
run rubocop --only Style/SwapValues bug.rb
Alternatively, run the following one-liner (in a shell that supports so-called "here strings"):
The following error message is printed when processing an otherwise perfectly valid Ruby file:
This appears to be caused - after a bit of digging - by the following exception:
Expected behavior
Consider the following Ruby script named
bug.rb
:It is completely valid (but possibly questionable) 😅 Ruby syntax:
It runs correctly:
It lints correctly:
Actual behavior
The
Style/SwapValues
cop chokes on it:Steps to reproduce the problem
bug.rb
with the above contentrubocop --only Style/SwapValues bug.rb
Alternatively, run the following one-liner (in a shell that supports so-called "here strings"):
Running this one-liner includes the stacktrace, and points at the root cause of the bug:
RuboCop version
The text was updated successfully, but these errors were encountered: