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
A terribly complex single line if/elsif should get corrected to a proper multi-line.
An error occurred while Style/OneLineConditional cop was inspecting /Users/tsmith/dev/the_world/request_tracker/recipes/default.rb:49:7. undefined method `if_type?' for nil:NilClass /Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/style/one_line_conditional.rb:92:in `else_branch_to_multiline' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/style/one_line_conditional.rb:87:in `multiline_replacement' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/style/one_line_conditional.rb:93:in `else_branch_to_multiline' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/style/one_line_conditional.rb:87:in `multiline_replacement' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/style/one_line_conditional.rb:60:in `replacement' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/style/one_line_conditional.rb:48:in `block in on_normal_if_unless' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/base.rb:333:in `correct' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/base.rb:126:in `add_offense' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/style/one_line_conditional.rb:47:in `on_normal_if_unless' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/mixin/on_normal_if_unless.rb:10:in `on_if' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/commissioner.rb:99:in `block (2 levels) in trigger_responding_cops' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/commissioner.rb:152:in `with_cop_error_handling' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/commissioner.rb:98:in `block in trigger_responding_cops' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/commissioner.rb:97:in `each' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/commissioner.rb:97:in `trigger_responding_cops' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/commissioner.rb:70:in `on_if' /usr/local/lib/ruby/gems/2.7.0/gems/rubocop-ast-0.4.2/lib/rubocop/ast/traversal.rb:70:in `on_lvasgn' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/commissioner.rb:72:in `on_lvasgn' /usr/local/lib/ruby/gems/2.7.0/gems/rubocop-ast-0.4.2/lib/rubocop/ast/traversal.rb:59:in `block in on_begin' /usr/local/lib/ruby/gems/2.7.0/gems/rubocop-ast-0.4.2/lib/rubocop/ast/traversal.rb:59:in `each' /usr/local/lib/ruby/gems/2.7.0/gems/rubocop-ast-0.4.2/lib/rubocop/ast/traversal.rb:59:in `on_begin' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/commissioner.rb:72:in `on_begin' /usr/local/lib/ruby/gems/2.7.0/gems/rubocop-ast-0.4.2/lib/rubocop/ast/traversal.rb:14:in `walk' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/commissioner.rb:85:in `investigate' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/team.rb:152:in `investigate_partial' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cop/team.rb:83:in `investigate' /Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:311:in `inspect_file' /Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:255:in `block in do_inspection_loop' /Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:289:in `block in iterate_until_no_changes' /Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:282:in `loop' /Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:282:in `iterate_until_no_changes' /Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:251:in `do_inspection_loop' /Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:128:in `block in file_offenses' /Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:153:in `file_offense_cache' /Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:127:in `file_offenses' /Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:118:in `process_file' /Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:97:in `block in each_inspected_file' /Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:96:in `each' /Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:96:in `reduce' /Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:96:in `each_inspected_file' /Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:82:in `inspect_files' /Users/tsmith/dev/oss/rubocop/lib/rubocop/runner.rb:43:in `run' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cli/command/execute_runner.rb:25:in `execute_runner' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cli/command/execute_runner.rb:17:in `run' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cli/command.rb:11:in `run' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cli/environment.rb:18:in `run' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cli.rb:65:in `run_command' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cli.rb:72:in `execute_runners' /Users/tsmith/dev/oss/rubocop/lib/rubocop/cli.rb:41:in `run' /Users/tsmith/dev/oss/rubocop/exe/rubocop:13:in `block in <top (required)>' /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/benchmark.rb:308:in `realtime' /Users/tsmith/dev/oss/rubocop/exe/rubocop:12:in `<top (required)>' /usr/local/lib/ruby/gems/2.7.0/bin/rubocop:23:in `load' /usr/local/lib/ruby/gems/2.7.0/bin/rubocop:23:in `<top (required)>' /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `load' /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `kernel_load' /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:28:in `run' /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli.rb:476:in `exec' /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run' /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command' /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor.rb:399:in `dispatch' /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli.rb:30:in `dispatch' /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/base.rb:476:in `start' /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli.rb:24:in `start' /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/exe/bundle:46:in `block in <top (required)>' /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/friendly_errors.rb:123:in `with_friendly_errors' /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/exe/bundle:34:in `<top (required)>' /usr/local/opt/ruby/bin/bundle:23:in `load' /usr/local/opt/ruby/bin/bundle:23:in `<main>'
Attempt to correct this code:
fcgi = if server == 'nginx' then true elsif server == 'apache' then false end
master
The text was updated successfully, but these errors were encountered:
[Fix rubocop#8771] Fix an error for Style/OneLineConditional
Style/OneLineConditional
9bdb1c5
Fixes rubocop#8771. This PR fixes an error for `Style/OneLineConditional` when using `if-then-elsif-then-end`.
[Fix #8771] Fix an error for Style/OneLineConditional
5cc162e
Fixes #8771. This PR fixes an error for `Style/OneLineConditional` when using `if-then-elsif-then-end`.
Successfully merging a pull request may close this issue.
Expected behavior
A terribly complex single line if/elsif should get corrected to a proper multi-line.
Actual behavior
Steps to reproduce the problem
Attempt to correct this code:
RuboCop version
The text was updated successfully, but these errors were encountered: