We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Juniors can be so creative in how poor they can write code 😆
Running this snippet:
unless abc a else unless cde b else c end end
causes this message: An error occurred while Style/UnlessElse cop was inspecting the_snippet.rb
An error occurred while Style/UnlessElse cop was inspecting the_snippet.rb
adding -d to obtain a backtrace:
Parser::Source::TreeRewriter detected clobbering /home/max/.rvm/gems/ruby-2.6.3/gems/parser-3.1.0.0/lib/parser/source/tree_rewriter.rb:427:in `trigger_policy' /home/max/.rvm/gems/ruby-2.6.3/gems/parser-3.1.0.0/lib/parser/source/tree_rewriter.rb:414:in `enforce_policy' /home/max/.rvm/gems/ruby-2.6.3/gems/parser-3.1.0.0/lib/parser/source/tree_rewriter/action.rb:233:in `call' /home/max/.rvm/gems/ruby-2.6.3/gems/parser-3.1.0.0/lib/parser/source/tree_rewriter/action.rb:233:in `swallow' /home/max/.rvm/gems/ruby-2.6.3/gems/parser-3.1.0.0/lib/parser/source/tree_rewriter/action.rb:97:in `with' /home/max/.rvm/gems/ruby-2.6.3/gems/parser-3.1.0.0/lib/parser/source/tree_rewriter/action.rb:124:in `place_in_hierarchy' /home/max/.rvm/gems/ruby-2.6.3/gems/parser-3.1.0.0/lib/parser/source/tree_rewriter/action.rb:106:in `do_combine' /home/max/.rvm/gems/ruby-2.6.3/gems/parser-3.1.0.0/lib/parser/source/tree_rewriter/action.rb:117:in `place_in_hierarchy' /home/max/.rvm/gems/ruby-2.6.3/gems/parser-3.1.0.0/lib/parser/source/tree_rewriter/action.rb:131:in `block in combine_children' /home/max/.rvm/gems/ruby-2.6.3/gems/parser-3.1.0.0/lib/parser/source/tree_rewriter/action.rb:130:in `each' /home/max/.rvm/gems/ruby-2.6.3/gems/parser-3.1.0.0/lib/parser/source/tree_rewriter/action.rb:130:in `inject' /home/max/.rvm/gems/ruby-2.6.3/gems/parser-3.1.0.0/lib/parser/source/tree_rewriter/action.rb:130:in `combine_children' /home/max/.rvm/gems/ruby-2.6.3/gems/parser-3.1.0.0/lib/parser/source/tree_rewriter/action.rb:221:in `merge' /home/max/.rvm/gems/ruby-2.6.3/gems/parser-3.1.0.0/lib/parser/source/tree_rewriter/action.rb:104:in `do_combine' /home/max/.rvm/gems/ruby-2.6.3/gems/parser-3.1.0.0/lib/parser/source/tree_rewriter/action.rb:30:in `combine' /home/max/.rvm/gems/ruby-2.6.3/gems/parser-3.1.0.0/lib/parser/source/tree_rewriter.rb:143:in `merge!' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cop/base.rb:291:in `apply_correction' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cop/base.rb:375:in `attempt_correction' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cop/base.rb:356:in `use_corrector' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cop/base.rb:350:in `correct' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cop/base.rb:127:in `add_offense' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cop/style/unless_else.rb:31:in `on_if' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cop/commissioner.rb:100:in `public_send' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cop/commissioner.rb:100:in `block (2 levels) in trigger_responding_cops' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cop/commissioner.rb:160:in `with_cop_error_handling' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cop/commissioner.rb:99:in `block in trigger_responding_cops' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cop/commissioner.rb:98:in `each' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cop/commissioner.rb:98:in `trigger_responding_cops' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cop/commissioner.rb:69:in `on_if' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-ast-1.15.1/lib/rubocop/ast/traversal.rb:154:in `on_if' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cop/commissioner.rb:71:in `on_if' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-ast-1.15.1/lib/rubocop/ast/traversal.rb:20:in `walk' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cop/commissioner.rb:86:in `investigate' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cop/team.rb:155:in `investigate_partial' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cop/team.rb:77:in `investigate' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/runner.rb:309:in `inspect_file' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/runner.rb:253:in `block in do_inspection_loop' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/runner.rb:287:in `block in iterate_until_no_changes' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/runner.rb:280:in `loop' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/runner.rb:280:in `iterate_until_no_changes' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/runner.rb:249:in `do_inspection_loop' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/runner.rb:130:in `block in file_offenses' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/runner.rb:155:in `file_offense_cache' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/runner.rb:129:in `file_offenses' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/runner.rb:120:in `process_file' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/runner.rb:101:in `block in each_inspected_file' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/runner.rb:100:in `each' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/runner.rb:100:in `reduce' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/runner.rb:100:in `each_inspected_file' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/runner.rb:86:in `inspect_files' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/runner.rb:47:in `run' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cli/command/execute_runner.rb:26:in `block in execute_runner' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cli/command/execute_runner.rb:52:in `with_redirect' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cli/command/execute_runner.rb:25:in `execute_runner' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cli/command/execute_runner.rb:17:in `run' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cli/command.rb:11:in `run' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cli/environment.rb:18:in `run' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cli.rb:71:in `run_command' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cli.rb:78:in `execute_runners' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/lib/rubocop/cli.rb:47:in `run' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/exe/rubocop:12:in `block in <top (required)>' /home/max/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/benchmark.rb:308:in `realtime' /home/max/.rvm/gems/ruby-2.6.3/gems/rubocop-1.25.0/exe/rubocop:12:in `<top (required)>' /home/max/.rvm/gems/ruby-2.6.3/bin/rubocop:23:in `load' /home/max/.rvm/gems/ruby-2.6.3/bin/rubocop:23:in `<main>' /home/max/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `eval' /home/max/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `<main>'
Happens with -a and -A. Seems related to having nested uses of the cop.
1.25.0 (using Parser 3.1.0.0, rubocop-ast 1.15.1, running on ruby 2.6.3 x86_64-linux)
AllCops: DisplayCopNames: true Exclude: - 'db/**/*' - '_*/**/*' - 'private/**/*' - 'public/**/*' Include: # those are pure ruby files used by gem axlsx as view - '**/*.axlsx' - '**/*.rake' TargetRubyVersion: 2.6 NewCops: disable
rubocop -d --config path_to_my_conf -a path_to_snippet.rb
The text was updated successfully, but these errors were encountered:
6915fd3
Merge pull request #10461 from jonas054/10375_fix_unless_else_autocor…
b901a9f
…rect [Fix #10375] Defer auto-correction of nested unless/else
No branches or pull requests
Juniors can be so creative in how poor they can write code 😆
Running this snippet:
causes this message:
An error occurred while Style/UnlessElse cop was inspecting the_snippet.rb
adding -d to obtain a backtrace:
Notes
Happens with -a and -A. Seems related to having nested uses of the cop.
RuboCop version
1.25.0 (using Parser 3.1.0.0, rubocop-ast 1.15.1, running on ruby 2.6.3 x86_64-linux)
RuboCop config
Command line
rubocop -d --config path_to_my_conf -a path_to_snippet.rb
The text was updated successfully, but these errors were encountered: