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

rubocop: Clean up Style/BlockDelimiters excludes and autofix offenses #14920

Merged
merged 1 commit into from
Mar 9, 2023

Conversation

issyl0
Copy link
Member

@issyl0 issyl0 commented Mar 7, 2023

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

  • The final part of Remove usage of Exclude with rubocop #14685, maybe?!
  • This will seem like a lot, but I feel like EnforcedStyle: braces_for_chaining config makes the most sense. It preserves a lot of the RSpec syntax we're used to in expect {} blocks that are chained to other things - quite a lot of them - and uses normal block syntax for non-chained methods (as the name suggests - I probably didn't need to write that down).

@BrewTestBot
Copy link
Member

Review period will end on 2023-03-08 at 23:00:45 UTC.

@BrewTestBot BrewTestBot added the waiting for feedback Merging is blocked until sufficient time has passed for review label Mar 7, 2023
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @issyl0! Let's change specs rather than the non-spec code here, if we want consistency.

@@ -152,10 +152,10 @@ def find_launchctl_with_wildcard(search)
regex = Regexp.escape(search).gsub("\\*", ".*")
system_command!("/bin/launchctl", args: ["list"])
.stdout.lines.drop(1) # skip stdout column headers
.map do |line|
.map { |line|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, really don't agree with this change. Would rather we enforced specs to use this format than change non-spec code for this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you want EnforcedStyle: line_count_based (the default) everywhere (so for multi-line blocks they're always do ... end?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@issyl0 Yes I think so.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@issyl0 issyl0 force-pushed the rubocop-block-delimiters branch from e3fc20d to b753677 Compare March 8, 2023 23:16
@BrewTestBot BrewTestBot removed the waiting for feedback Merging is blocked until sufficient time has passed for review label Mar 8, 2023
@BrewTestBot
Copy link
Member

Review period ended.

@issyl0 issyl0 force-pushed the rubocop-block-delimiters branch from b753677 to 1be614e Compare March 8, 2023 23:48
- The defaults of using "do ... end" for multi-line blocks everywhere is
  good, better than switching everything to braces everywhere.
@issyl0 issyl0 force-pushed the rubocop-block-delimiters branch from 1be614e to 3a83b54 Compare March 8, 2023 23:54
@MikeMcQuaid MikeMcQuaid enabled auto-merge March 9, 2023 08:38
@MikeMcQuaid
Copy link
Member

Nice, thanks @issyl0!

@MikeMcQuaid MikeMcQuaid merged commit 4bf55c6 into Homebrew:master Mar 9, 2023
@issyl0 issyl0 deleted the rubocop-block-delimiters branch March 9, 2023 09:46
@github-actions github-actions bot added the outdated PR was locked due to age label Apr 9, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants