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

An error occurred while Style/NestedTernaryOperator cop was inspecting a file #10734

Closed
williamhancharek opened this issue Jun 22, 2022 · 0 comments · Fixed by #10739
Closed
Assignees
Labels

Comments

@williamhancharek
Copy link

@williamhancharek williamhancharek commented Jun 22, 2022

I was running Rubocop and it came across an error that it asked me to report. My version of rubocop is not the exact latest, but I checked the list of issues and did not find anything similar to what I encountered.


Expected behavior

running bundle exec rubocop -a would not have any errors

Actual behavior

An error occurred while Style/NestedTernaryOperator cop was inspecting a file.

The prompt said to mention the following information in the issue report:
1.28.2 (using Parser 3.1.2.0, rubocop-ast 1.17.0, running on ruby 2.5.7 x86_64-darwin21)

Describe here what actually happened.
Please use rubocop --debug when pasting rubocop output as it contains additional information.

Steps to reproduce the problem

the problematic lines were:

  def status(val)
    cup.handle.try(:broken?) ? '(broken)' : cup.no_handle_available? ? '(none)' : cup.handle.has_old_handle? ? '(legacy)' : ''
  end
      fluid = liquid_amount.hot? ? liquid_type[:tea] :
                     liquid_amount.cold? ? liquid_type[:iced_tea] :
                         liquid_amount.sugary? ? liquid_type[:sweetened] :
                             liquid_type[:plain_water]

RuboCop version

bundle exec rubocop -V
1.28.2 (using Parser 3.1.2.0, rubocop-ast 1.17.0, running on ruby 2.5.7 x86_64-darwin21)
  - rubocop-performance 1.13.3
  - rubocop-rails 2.14.2
  - rubocop-rspec 2.10.0
@koic koic added the bug label Jun 22, 2022
@dvandersluis dvandersluis self-assigned this Jun 22, 2022
dvandersluis added a commit to dvandersluis/rubocop that referenced this issue Jun 22, 2022
…perator` when there are multiple nested ternaries.
dvandersluis added a commit to dvandersluis/rubocop that referenced this issue Jun 22, 2022
…perator` when there are multiple nested ternaries.
bbatsov pushed a commit that referenced this issue Jun 24, 2022
…` when there are multiple nested ternaries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants