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

Add new "Single-line do...end block" rule #922

Merged
merged 1 commit into from
Nov 5, 2023

Conversation

koic
Copy link
Member

@koic koic commented Sep 29, 2023

Follow up rubocop/rubocop#12227 (comment)

This PR adds new "Single-line do...end block" rule.

Use multi-line do...end block instead of single-line do...end block.

# bad
foo do |arg| bar(arg) end

# good
foo do |arg|
  bar(arg)
end

# bad
->(arg) do bar(arg) end

# good
->(arg) { bar(arg) }

@koic koic force-pushed the add_new_single_line_do_end_block_rule branch from 934a745 to a7c5f87 Compare September 29, 2023 12:44
@koic koic changed the title Add new Single-line do...end block rule Add new "Single-line do...end block" rule Sep 29, 2023
Follow up rubocop/rubocop#12227 (comment)

This PR adds new "Single-line `do`...`end` block" rule.

Use multi-line `do`...`end` block instead of single-line `do`...`end` block.

```ruby
# bad
foo do |arg| bar(arg) end

# good
foo do |arg|
  bar(arg)
end

# bad
->(arg) do bar(arg) end

# good
->(arg) { bar(arg) }
```
@koic koic force-pushed the add_new_single_line_do_end_block_rule branch from a7c5f87 to 9719513 Compare September 29, 2023 12:48
@bbatsov bbatsov merged commit 927480e into rubocop:master Nov 5, 2023
3 checks passed
@koic koic deleted the add_new_single_line_do_end_block_rule branch November 5, 2023 07:29
koic added a commit to rubocop/rubocop that referenced this pull request Nov 5, 2023
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