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

Parser::Source::TreeRewriter detected clobbering during Lint/EmptyConditionalBody #10951

Closed
Earlopain opened this issue Aug 22, 2022 · 0 comments · Fixed by #10952
Closed

Parser::Source::TreeRewriter detected clobbering during Lint/EmptyConditionalBody #10951

Earlopain opened this issue Aug 22, 2022 · 0 comments · Fixed by #10952
Labels

Comments

@Earlopain
Copy link
Contributor

Complete error log
An error occurred while Lint/EmptyConditionalBody cop was inspecting /home/earlopain/Documents/test.rb:2:2.
Parser::Source::TreeRewriter detected clobbering
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter.rb:427:in `trigger_policy'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter.rb:414:in `enforce_policy'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter/action.rb:233:in `call'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter/action.rb:233:in `swallow'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter/action.rb:97:in `with'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter/action.rb:124:in `place_in_hierarchy'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter/action.rb:106:in `do_combine'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter/action.rb:117:in `place_in_hierarchy'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter/action.rb:106:in `do_combine'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter/action.rb:30:in `combine'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter.rb:400:in `combine'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter.rb:194:in `replace'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/lint/empty_conditional_body.rb:103:in `correct_other_branches'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/lint/empty_conditional_body.rb:84:in `autocorrect'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/lint/empty_conditional_body.rb:75:in `block in on_if'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/base.rb:346:in `correct'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/base.rb:127:in `add_offense'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/lint/empty_conditional_body.rb:74:in `on_if'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/commissioner.rb:100:in `public_send'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/commissioner.rb:100:in `block (2 levels) in trigger_responding_cops'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/commissioner.rb:160:in `with_cop_error_handling'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/commissioner.rb:99:in `block in trigger_responding_cops'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/commissioner.rb:98:in `each'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/commissioner.rb:98:in `trigger_responding_cops'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/commissioner.rb:69:in `on_if'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-ast-1.21.0/lib/rubocop/ast/traversal.rb:153:in `on_class'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/commissioner.rb:71:in `on_class'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-ast-1.21.0/lib/rubocop/ast/traversal.rb:20:in `walk'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/commissioner.rb:86:in `investigate'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/team.rb:155:in `investigate_partial'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/team.rb:83:in `investigate'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:311:in `inspect_file'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:255:in `block in do_inspection_loop'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:289:in `block in iterate_until_no_changes'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:282:in `loop'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:282:in `iterate_until_no_changes'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:251:in `do_inspection_loop'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:134:in `block in file_offenses'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:159:in `file_offense_cache'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:133:in `file_offenses'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:69:in `block in warm_cache'
/home/earlopain/.gem/ruby/3.1.0/gems/parallel-1.22.1/lib/parallel.rb:587:in `call_with_index'
/home/earlopain/.gem/ruby/3.1.0/gems/parallel-1.22.1/lib/parallel.rb:557:in `process_incoming_jobs'
/home/earlopain/.gem/ruby/3.1.0/gems/parallel-1.22.1/lib/parallel.rb:537:in `block in worker'
/home/earlopain/.gem/ruby/3.1.0/gems/parallel-1.22.1/lib/parallel.rb:528:in `fork'
/home/earlopain/.gem/ruby/3.1.0/gems/parallel-1.22.1/lib/parallel.rb:528:in `worker'
/home/earlopain/.gem/ruby/3.1.0/gems/parallel-1.22.1/lib/parallel.rb:519:in `block in create_workers'
/home/earlopain/.gem/ruby/3.1.0/gems/parallel-1.22.1/lib/parallel.rb:518:in `each'
/home/earlopain/.gem/ruby/3.1.0/gems/parallel-1.22.1/lib/parallel.rb:518:in `each_with_index'
/home/earlopain/.gem/ruby/3.1.0/gems/parallel-1.22.1/lib/parallel.rb:518:in `create_workers'
/home/earlopain/.gem/ruby/3.1.0/gems/parallel-1.22.1/lib/parallel.rb:457:in `work_in_processes'
/home/earlopain/.gem/ruby/3.1.0/gems/parallel-1.22.1/lib/parallel.rb:294:in `map'
/home/earlopain/.gem/ruby/3.1.0/gems/parallel-1.22.1/lib/parallel.rb:238:in `each'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:69:in `warm_cache'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:46:in `run'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cli/command/execute_runner.rb:26:in `block in execute_runner'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cli/command/execute_runner.rb:52:in `with_redirect'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cli/command/execute_runner.rb:25:in `execute_runner'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cli/command/execute_runner.rb:17:in `run'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cli/command.rb:11:in `run'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cli/environment.rb:18:in `run'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cli.rb:72:in `run_command'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cli.rb:79:in `execute_runners'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cli.rb:48:in `run'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/exe/rubocop:19:in `block in <top (required)>'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/3.1.0/benchmark.rb:311:in `realtime'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/exe/rubocop:19:in `<top (required)>'
/home/earlopain/.rbenv/versions/3.1.2/bin/rubocop:25:in `load'
/home/earlopain/.rbenv/versions/3.1.2/bin/rubocop:25:in `<top (required)>'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib/bundler/cli/exec.rb:58:in `load'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib/bundler/cli/exec.rb:58:in `kernel_load'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib/bundler/cli/exec.rb:23:in `run'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib/bundler/cli.rb:483:in `exec'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib/bundler/cli.rb:31:in `dispatch'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib/bundler/cli.rb:25:in `start'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/exe/bundle:48:in `block in <top (required)>'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/exe/bundle:36:in `<top (required)>'
/home/earlopain/.rbenv/versions/3.1.2/bin/bundle:25:in `load'
/home/earlopain/.rbenv/versions/3.1.2/bin/bundle:25:in `<main>'
Inspecting 1 file
Scanning /home/earlopain/Documents/test.rb
An error occurred while Lint/EmptyConditionalBody cop was inspecting /home/earlopain/Documents/test.rb:2:2.
Parser::Source::TreeRewriter detected clobbering
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter.rb:427:in `trigger_policy'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter.rb:414:in `enforce_policy'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter/action.rb:233:in `call'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter/action.rb:233:in `swallow'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter/action.rb:97:in `with'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter/action.rb:124:in `place_in_hierarchy'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter/action.rb:106:in `do_combine'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter/action.rb:117:in `place_in_hierarchy'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter/action.rb:106:in `do_combine'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter/action.rb:30:in `combine'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter.rb:400:in `combine'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/parser-3.1.2.1/lib/parser/source/tree_rewriter.rb:194:in `replace'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/lint/empty_conditional_body.rb:103:in `correct_other_branches'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/lint/empty_conditional_body.rb:84:in `autocorrect'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/lint/empty_conditional_body.rb:75:in `block in on_if'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/base.rb:346:in `correct'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/base.rb:127:in `add_offense'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/lint/empty_conditional_body.rb:74:in `on_if'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/commissioner.rb:100:in `public_send'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/commissioner.rb:100:in `block (2 levels) in trigger_responding_cops'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/commissioner.rb:160:in `with_cop_error_handling'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/commissioner.rb:99:in `block in trigger_responding_cops'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/commissioner.rb:98:in `each'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/commissioner.rb:98:in `trigger_responding_cops'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/commissioner.rb:69:in `on_if'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-ast-1.21.0/lib/rubocop/ast/traversal.rb:153:in `on_class'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/commissioner.rb:71:in `on_class'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-ast-1.21.0/lib/rubocop/ast/traversal.rb:20:in `walk'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/commissioner.rb:86:in `investigate'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/team.rb:155:in `investigate_partial'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cop/team.rb:83:in `investigate'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:311:in `inspect_file'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:255:in `block in do_inspection_loop'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:289:in `block in iterate_until_no_changes'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:282:in `loop'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:282:in `iterate_until_no_changes'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:251:in `do_inspection_loop'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:134:in `block in file_offenses'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:159:in `file_offense_cache'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:133:in `file_offenses'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:124:in `process_file'
/home/earlopain/.rbeoutside of the class.nv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:105:in `block in each_inspected_file'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:104:in `each'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:104:in `reduce'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:104:in `each_inspected_file'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:90:in `inspect_files'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/runner.rb:47:in `run'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cli/command/execute_runner.rb:26:in `block in execute_runner'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cli/command/execute_runner.rb:52:in `with_redirect'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cli/command/execute_runner.rb:25:in `execute_runner'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cli/command/execute_runner.rb:17:in `run'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cli/command.rb:11:in `run'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cli/environment.rb:18:in `run'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cli.rb:72:in `run_command'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cli.rb:79:in `execute_runners'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/lib/rubocop/cli.rb:48:in `run'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/exe/rubocop:19:in `block in <top (required)>'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/3.1.0/benchmark.rb:311:in `realtime'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rubocop-1.35.1/exe/rubocop:19:in `<top (required)>'
/home/earlopain/.rbenv/versions/3.1.2/bin/rubocop:25:in `load'
/home/earlopain/.rbenv/versions/3.1.2/bin/rubocop:25:in `<top (required)>'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib/bundler/cli/exec.rb:58:in `load'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib/bundler/cli/exec.rb:58:in `kernel_load'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib/bundler/cli/exec.rb:23:in `run'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib/bundler/cli.rb:483:in `exec'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib/bundler/cli.rb:31:in `dispatch'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib/bundler/cli.rb:25:in `start'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/exe/bundle:48:in `block in <top (required)>'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
/home/earlopain/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.12/exe/bundle:36:in `<top (required)>'
/home/earlopain/.rbenv/versions/3.1.2/bin/bundle:25:in `load'
/home/earlopain/.rbenv/versions/3.1.2/bin/bundle:25:in `<main>'
W

Offenses:

test.rb:3:3: W: [Correctable] Lint/EmptyConditionalBody: Avoid elsif branches without a body.
elsif condition2
^^^^^^^^^^^^^^^^

1 file inspected, 1 offense detected, 1 offense autocorrectable

1 error occurred:
An error occurred while Lint/EmptyConditionalBody cop was inspecting /home/earlopain/Documents/test.rb:2:2.

Steps to reproduce the problem

Here's a minimally reproducable piece of code. The class is required, it works normally when it's top-level code.

class Test
  if condition1
  elsif condition2
  end
end

RuboCop version

1.35.1 (using Parser 3.1.2.1, rubocop-ast 1.21.0, running on ruby 3.1.2 x86_64-linux)
@koic koic added the bug label Aug 24, 2022
ydah added a commit to ydah/rubocop that referenced this issue Aug 26, 2022
…ionalBody` when some conditional branch is empty

Fix: rubocop#10951
koic added a commit that referenced this issue Aug 27, 2022
[Fix #10951] Fix an autocorrection error for `Lint/EmptyConditionalBody` when some conditional branch is empty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants