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
I expect this piece of code to not trigger Rubocop errors.
defayocasevariablewhen1'hey'endend
Actual behavior
1 error occurred:
An error occurred while Style/EmptyElse cop was inspecting /Users/chedli/code/file..rb:24:8.
configuration from /Users/chedli/code/work/hoggo/.rubocop.yml
Errors are usually caused by RuboCop bugs.
Please, report your problems to RuboCop's issue tracker.
https://github.com/rubocop/rubocop/issues
Mention the following information in the issue report:
1.66.0 (using Parser 3.3.4.2, rubocop-ast 1.32.1, running on ruby 3.3.4) [arm64-darwin23]
Finished in 0.5535610000079032 seconds
**Here is the stacktrace: **
Stacktrace
undefined method `join' for nil
/Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-1.66.0/lib/rubocop/cop/style/empty_else.rb:183:in `comment_in_else?'
/Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-1.66.0/lib/rubocop/cop/style/empty_else.rb:146:in `check'
/Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-1.66.0/lib/rubocop/cop/style/empty_else.rb:140:in `on_case'
/Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-1.66.0/lib/rubocop/cop/commissioner.rb:107:in `public_send'
/Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-1.66.0/lib/rubocop/cop/commissioner.rb:107:in `block (2 levels) in trigger_responding_cops'
/Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-1.66.0/lib/rubocop/cop/commissioner.rb:171:in `with_cop_error_handling'
/Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-1.66.0/lib/rubocop/cop/commissioner.rb:106:in `block in trigger_responding_cops'
/Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-1.66.0/lib/rubocop/cop/commissioner.rb:105:in `each'
/Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-1.66.0/lib/rubocop/cop/commissioner.rb:105:in `trigger_responding_cops'
/Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-1.66.0/lib/rubocop/cop/commissioner.rb:69:in `on_case'
/Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-ast-1.32.1/lib/rubocop/ast/traversal.rb:154:in `on_def'
/Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-1.66.0/lib/rubocop/cop/commissioner.rb:71:in `on_def'
/Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-ast-1.32.1/lib/rubocop/ast/traversal.rb:137:in `block in on_dstr'
/Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-ast-1.32.1/lib/rubocop/ast/traversal.rb:137:in `each'
/Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-ast-1.32.1/lib/rubocop/ast/traversal.rb:137:in `on_dstr'
It seems that when a case..when does not have an else clause it trieggers this bug. here is a minimal rubocop.yml which triggers the error.
Style/EmptyElse:
AllowComments: true
without AllowComments: true this piece of code works, so I guess it's related
RuboCop version
1.66.0 (using Parser 3.3.4.2, rubocop-ast 1.32.1, running on ruby 3.3.4) [arm64-darwin23]
Finished in 0.5535610000079032 seconds
The text was updated successfully, but these errors were encountered:
Related to #13086
Expected behavior
I expect this piece of code to not trigger Rubocop errors.
Actual behavior
**Here is the stacktrace: **
Stacktrace
undefined method `join' for nil /Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-1.66.0/lib/rubocop/cop/style/empty_else.rb:183:in `comment_in_else?' /Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-1.66.0/lib/rubocop/cop/style/empty_else.rb:146:in `check' /Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-1.66.0/lib/rubocop/cop/style/empty_else.rb:140:in `on_case' /Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-1.66.0/lib/rubocop/cop/commissioner.rb:107:in `public_send' /Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-1.66.0/lib/rubocop/cop/commissioner.rb:107:in `block (2 levels) in trigger_responding_cops' /Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-1.66.0/lib/rubocop/cop/commissioner.rb:171:in `with_cop_error_handling' /Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-1.66.0/lib/rubocop/cop/commissioner.rb:106:in `block in trigger_responding_cops' /Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-1.66.0/lib/rubocop/cop/commissioner.rb:105:in `each' /Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-1.66.0/lib/rubocop/cop/commissioner.rb:105:in `trigger_responding_cops' /Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-1.66.0/lib/rubocop/cop/commissioner.rb:69:in `on_case' /Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-ast-1.32.1/lib/rubocop/ast/traversal.rb:154:in `on_def' /Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-1.66.0/lib/rubocop/cop/commissioner.rb:71:in `on_def' /Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-ast-1.32.1/lib/rubocop/ast/traversal.rb:137:in `block in on_dstr' /Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-ast-1.32.1/lib/rubocop/ast/traversal.rb:137:in `each' /Users/chedli/.rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/rubocop-ast-1.32.1/lib/rubocop/ast/traversal.rb:137:in `on_dstr'case..when
does not have an else clause it trieggers this bug. here is a minimalrubocop.yml
which triggers the error.without
AllowComments: true
this piece of code works, so I guess it's relatedRuboCop version
The text was updated successfully, but these errors were encountered: