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

MultilineOperationIndentation wants different indentation when using multiple blocks #2832

Closed
hoffi opened this issue Feb 11, 2016 · 1 comment
Assignees
Labels

Comments

@hoffi
Copy link

hoffi commented Feb 11, 2016

I have enabled the MultilineOperationIndentation with EnforcedStyle: aligned and using Rubocop Version 0.36.0.

When i span an operation across multiple lines i can indent the subsequent lines by 2 spaces. But when i open a second block there, it looks like Rubocop gets confused and brings a warning when i do this there.

Example to show what i mean:

## This is ok:
a = b.map do |c|
  c +
    b
end

## Invalid:
a = b.map do |c|
  c +
    b + # This is allowed
    d do
      x +
        y # "Align the operands of an expression spanning multiple lines." at this line
    end
end

## Second example as valid code:
a = b.map do |c|
  c +
    b +
    d do
      x +
      y    # No 2 space indentation
    end
end

This is occurs in version 0.37.1.

@hoffi hoffi changed the title MultilineOperationIndentation-Cop wants different indentation when using multiple blocks MultilineOperationIndentation wants different indentation when using multiple blocks Feb 11, 2016
@jonas054 jonas054 added the bug label Feb 14, 2016
@jonas054 jonas054 self-assigned this Feb 14, 2016
@jonas054
Copy link
Collaborator

Yes, that looks like a bug. I'll try to fix it.

bbatsov added a commit that referenced this issue Feb 21, 2016
…k_bug

[Fix #2832] Handle blocks in expressions in MultilineOperationIndentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants