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
For /Users/Drowze/workspace/ruby-scripts: Default configuration from /Users/Drowze/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.18.4/config/default.yml
Inspecting 1 file
Scanning /Users/Drowze/workspace/ruby-scripts/test.rb
Loading cache from /Users/Drowze/.cache/rubocop_cache/f0c6549b3ba85dee6fbdac52c969fbbd0c5e7eeb/0536d18c9eb040c724be8df71fd74a67730b58ef/551f83ba8d8268e0ebf3d6681dc8d5840df5f64c
W
Offenses:
test.rb:1:1: C: [Correctable] Style/FrozenStringLiteralComment: Missing frozen string literal comment.
def my_method
^
test.rb:1:14: C: [Corrected] Style/DefWithParentheses: Omit the parentheses in defs when the method doesn't accept any arguments.
def my_method()
^
test.rb:1:16: W: [Corrected] Lint/UnusedMethodArgument: Unused method argument - block. If it's necessary, use _ or _block as an argument name to indicate that it won't be used. You can also write as my_method(*) if you want the method to accept any arguments but don't care about them.
def my_method(&block)
^^^^^
test.rb:2:3: C: [Corrected] Style/ExplicitBlockArgument: Consider using explicit block argument in the surrounding method's signature over yield.
[1, 2, 3].map { yield }
^^^^^^^^^^^^^^^^^^^^^^^
test.rb:5:1: W: Lint/AmbiguousBlockAssociation: Parenthesize the param my_method { 'hello' } to make sure that the block will be associated with the my_method method call.
puts my_method { 'hello' }
^^^^^^^^^^^^^^^^^^^^^^^^^^
1 file inspected, 5 offenses detected, 3 offenses corrected, 1 more offense can be corrected with `rubocop -A`
Finished in 0.25655099999858066 seconds
Expected behavior
I expect Rubocop not to break existing code.
Actual behavior
When running autocorrection on rubocop default configuration, it breaks my Ruby script
Steps to reproduce the problem
Given a default rubocop configuration
Given
test.rb
:When I run
rubocop --debug -a test.rb
It autocorrects the file to: (notice
block
will raise aundefined local variable
error)And I get this output:
RuboCop version
The text was updated successfully, but these errors were encountered: