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 Layout/ElseAlignment for rescue/else/ensure inside do/end blocks with assignment. #8912

Merged
merged 1 commit into from
Oct 30, 2020
Merged

Fix Layout/ElseAlignment for rescue/else/ensure inside do/end blocks with assignment. #8912

merged 1 commit into from
Oct 30, 2020

Conversation

miry
Copy link
Contributor

@miry miry commented Oct 21, 2020

Fix the problem of broken indent of else iniside block with rescue:

# bad
var = array.map do |i|
  code
rescue
  code
      else
        code
end

# good
var = array.map do |i|
  code
rescue
  code
else
  code
end

Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.

@bbatsov bbatsov requested a review from koic October 22, 2020 10:41
@miry
Copy link
Contributor Author

miry commented Oct 29, 2020

@koic Let me know if you need something from my side to test this PR.

CHANGELOG.md Outdated Show resolved Hide resolved
@koic
Copy link
Member

koic commented Oct 30, 2020

@miry Thank you for fixing! I commented a little feedback, anyway overall it looks good to me.

@koic
Copy link
Member

koic commented Oct 30, 2020

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

…with assignment.

Fix the problem of broken indent of else iniside block with rescue:

```ruby
 # bad
var = array.map do |i|
  code
rescue
  code
      else
        code
end

 # good
var = array.map do |i|
  code
rescue
  code
else
  code
end
```

Co-authored-by: Koichi ITO <koic.ito@gmail.com>
@miry
Copy link
Contributor Author

miry commented Oct 30, 2020

@koic done

@bbatsov bbatsov merged commit 250fe02 into rubocop:master Oct 30, 2020
@bbatsov
Copy link
Collaborator

bbatsov commented Oct 30, 2020

Thanks!

@miry miry deleted the layout-else-in-block-rescue-assignment branch October 30, 2020 10:21
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.

3 participants