Skip to content

rubocops/cask/array_alphabetization: skip blank lines when sorting #17100

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

Merged

Conversation

krehel
Copy link
Member

@krehel krehel commented Apr 17, 2024

  • 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?

Minor fix to sorting lines when alphabetizing arrays, as empty lines (or all whitespace) cause an apparent break. This simply skips those when rewriting zap and uininstall stanzas.

Cop Layout/EmptyLines will correct multiple blank lines in a row, but something like the below won't be fixed (example with the expressvpn Cask)

  zap trash: [
    "/Library/Application Support/com.expressvpn.ExpressVPN",
    "/Library/LaunchDaemons/com.expressvpn.expressvpnd.plist",
    "~/Library/Application Support/com.expressvpn.ExpressVPN",
    "~/Library/HTTPStorages/com.expressvpn.ExpressVPN",

    "~/Library/Logs/ExpressVPN",
    "~/Library/Preferences/com.expressvpn.ExpressVPN.plist",
  ]

Which results in An error occurred while Cask/ArrayAlphabetization cop was inspecting /opt/homebrew/Library/Taps/homebrew/homebrew-cask/Casks/e/expressvpn.rb:25:2.

@p-linnane p-linnane requested a review from issyl0 April 17, 2024 18:08
Copy link
Member

@issyl0 issyl0 left a comment

Choose a reason for hiding this comment

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

This is a personal preference thing but I think I'd prefer a separate next for this rather than an ||.

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.

Looks good with @issyl0's suggestion applied!

@krehel
Copy link
Member Author

krehel commented Apr 17, 2024

No worries! I did it that way first, and then decided I'd || it. I'll apply this suggestion!

@krehel krehel force-pushed the array-alphabetization-blank-line-fix branch from b645db9 to 36cc201 Compare April 17, 2024 18:23
@p-linnane p-linnane enabled auto-merge April 17, 2024 18:28
Copy link
Member

@issyl0 issyl0 left a comment

Choose a reason for hiding this comment

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

Thanks Justin!

@p-linnane p-linnane merged commit 929995c into Homebrew:master Apr 17, 2024
@krehel krehel deleted the array-alphabetization-blank-line-fix branch April 17, 2024 18:33
@github-actions github-actions bot added the outdated PR was locked due to age label May 18, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 18, 2024
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.

4 participants