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

Fix assignment edge-cases in Layout/MultilineAssignmentLayout #7438

Merged

Conversation

gsamokovarov
Copy link
Contributor

@gsamokovarov gsamokovarov commented Oct 16, 2019

Assignments from :[]= or setter methods (foo.bar=(value)) like the ones below did not produce cop reports and were not autocorrected. Now, they are!

hash[:foo] = if true
^^^^^^^^^^^^^^^^^^^^ Right hand side of multi-line assignment is on the same line as the assignment operator `=`.
end
foo.bar = if true
^^^^^^^^^^^^^^^^^^^^ Right hand side of multi-line assignment is on the same line as the assignment operator `=`.
end

@gsamokovarov gsamokovarov changed the title Fix []= assignment edge-case in MultilineAssignmentLayout Fix assignment edge-cases in MultilineAssignmentLayout Oct 16, 2019
@gsamokovarov gsamokovarov changed the title Fix assignment edge-cases in MultilineAssignmentLayout Fix assignment edge-cases in Layout/MultilineAssignmentLayout Oct 16, 2019
@gsamokovarov gsamokovarov force-pushed the multiline-assignment-layout-edge-case branch 2 times, most recently from 3b11b6e to db986cc Compare October 16, 2019 13:25
CHANGELOG.md Show resolved Hide resolved
@gsamokovarov gsamokovarov force-pushed the multiline-assignment-layout-edge-case branch from c8fb49b to b200339 Compare October 17, 2019 10:36
@koic
Copy link
Member

koic commented Oct 17, 2019

This looks good to me. Can you squash your commits into one?

Assignments from `:[]=` or setter methods (`foo.bar=(value)`) like the ones below did not produce cop reports and were not autocorrected. Now, they are!

```ruby
hash[:foo] = if true
^^^^^^^^^^^^^^^^^^^^ Right hand side of multi-line assignment is on the same line as the assignment operator `=`.
end
```

```ruby
foo.bar = if true
^^^^^^^^^^^^^^^^^^^^ Right hand side of multi-line assignment is on the same line as the assignment operator `=`.
end
```
@gsamokovarov gsamokovarov force-pushed the multiline-assignment-layout-edge-case branch from b200339 to d80771d Compare October 17, 2019 10:51
@gsamokovarov
Copy link
Contributor Author

gsamokovarov commented Oct 17, 2019

Done! If everything is fine with the latest build, we will be good to go.

@koic koic merged commit 8b8141b into rubocop:master Oct 18, 2019
@koic
Copy link
Member

koic commented Oct 18, 2019

Thanks always!

@gsamokovarov gsamokovarov deleted the multiline-assignment-layout-edge-case branch October 18, 2019 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants