Skip to content

bundle/remover: Remove description comments#21735

Merged
MikeMcQuaid merged 3 commits intomainfrom
bundle-remove-comments
Mar 22, 2026
Merged

bundle/remover: Remove description comments#21735
MikeMcQuaid merged 3 commits intomainfrom
bundle-remove-comments

Conversation

@issyl0
Copy link
Copy Markdown
Member

@issyl0 issyl0 commented Mar 14, 2026

  • 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 lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes.

@issyl0 issyl0 force-pushed the bundle-remove-comments branch from 4bdffd1 to 1974d89 Compare March 14, 2026 17:34
@issyl0 issyl0 marked this pull request as ready for review March 14, 2026 17:53
Copilot AI review requested due to automatic review settings March 14, 2026 17:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates brew bundle remove so that when an entry is removed from a Brewfile, any directly preceding description comment (typically produced by brew bundle dump --describe) is also cleaned up, addressing #21732.

Changes:

  • Update the Bundle remover logic to drop a directly preceding comment line when removing a matching entry.
  • Add an RSpec example asserting that a preceding description comment is removed along with the entry.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
Library/Homebrew/bundle/remover.rb Adjusts line-removal logic to also remove a preceding comment line when an entry is removed.
Library/Homebrew/test/bundle/commands/remove_spec.rb Adds coverage to ensure a preceding description comment is removed with the entry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Library/Homebrew/bundle/remover.rb Outdated
Comment thread Library/Homebrew/test/bundle/commands/remove_spec.rb
Copy link
Copy Markdown
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, looking good so far!

Comment thread Library/Homebrew/bundle/remover.rb Outdated
Comment thread Library/Homebrew/bundle/remover.rb Outdated
Comment thread Library/Homebrew/bundle/remover.rb
Comment thread Library/Homebrew/test/bundle/commands/remove_spec.rb
Comment thread Library/Homebrew/bundle/remover.rb Outdated
- Fixes #21732.
- When `brew bundle remove`ing, also clean up the directly preceding
  description comment (from `brew bundle dump --describe`, or any
  others).
@issyl0 issyl0 force-pushed the bundle-remove-comments branch from 1fbf887 to 1c541b0 Compare March 20, 2026 22:45
Copy link
Copy Markdown
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, almost there, thanks @issyl0!

Comment thread Library/Homebrew/bundle/remover.rb
Comment thread Library/Homebrew/bundle/remover.rb
- So that we don't remove things that users might have added themselves
  to segment their Brewfile into sections.
- I needed to get the formula itself to check the description, and the
  cask, so I extracted a method `find_formula_or_cask` to avoid
  duplicating that logic in `possible_names` and `description_comment?`.
@issyl0 issyl0 force-pushed the bundle-remove-comments branch from 1c541b0 to 8c06615 Compare March 21, 2026 13:30
Comment thread Library/Homebrew/bundle/remover.rb Outdated
Comment thread Library/Homebrew/bundle/remover.rb
Comment thread Library/Homebrew/bundle/remover.rb Outdated
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
@MikeMcQuaid MikeMcQuaid force-pushed the bundle-remove-comments branch from f3c20a1 to b074b4c Compare March 22, 2026 14:07
@MikeMcQuaid
Copy link
Copy Markdown
Member

Thanks @issyl0!

@MikeMcQuaid MikeMcQuaid enabled auto-merge March 22, 2026 14:07
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Mar 22, 2026
Merged via the queue into main with commit d2b03f3 Mar 22, 2026
93 of 98 checks passed
@MikeMcQuaid MikeMcQuaid deleted the bundle-remove-comments branch March 22, 2026 16:00
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.

brew bundle remove does not clean up descriptions in Brewfile

3 participants