Rubocop: Error with multiline ternary operators

Created on 26 Sep 2017  路  1Comment  路  Source: rubocop-hq/rubocop

Expected behavior

Describe here how you expected RuboCop to behave in this particular situation.

With this sample code:

one ||
  two ? 3 : 5

Rubocop should report the offence with multi-line ternary operators according to the configuration.

Actual behavior

The offence is reported correctly but with an error:

1 error occurred:
An error occurred while Layout/MultilineOperationIndentation cop was inspecting /Users/jrmhaig/workspace/rubocop_test/test.rb:1:0.
Errors are usually caused by RuboCop bugs.
Please, report your problems to RuboCop's issue tracker.
Mention the following information in the issue report:
0.50.0 (using Parser 2.4.0.0, running on ruby 2.4.1 x86_64-darwin16)
Finished in 0.12138300016522408 seconds

Steps to reproduce the problem

Create a file test.rb containing:

one ||
  two ? 3 : 5

and execute Rubocop.

RuboCop version

Include the output of rubocop -V. Here's an example:

$ rubocop -V
0.50.0 (using Parser 2.4.0.0, running on ruby 2.4.1 x86_64-darwin16)
bug

Most helpful comment

I think I have a fix for this. I will try to create a PR soon. I need to go over some other test cases.

>All comments

I think I have a fix for this. I will try to create a PR soon. I need to go over some other test cases.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mikegee picture mikegee  路  3Comments

ecbrodie picture ecbrodie  路  3Comments

herwinw picture herwinw  路  3Comments

lepieru picture lepieru  路  3Comments

david942j picture david942j  路  3Comments