Skip to content

Share full-name parsing helpers#21966

Merged
MikeMcQuaid merged 1 commit intomainfrom
share-full-name-utils
Apr 10, 2026
Merged

Share full-name parsing helpers#21966
MikeMcQuaid merged 1 commit intomainfrom
share-full-name-utils

Conversation

@MikeMcQuaid
Copy link
Copy Markdown
Member

  • keep full_name parsing consistent across formula and cask code
  • reduce repeated split("/") logic so tap and name extraction do not drift in commands, bundle code, and migrations
  • cover Utils.name_from_full_name and Utils.tap_from_full_name in test/utils_spec.rb

  • 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 (excluding integration 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.

Used OpenAI Codex with manual review and feedback.


Copilot AI review requested due to automatic review settings April 9, 2026 14:36
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 centralizes parsing of tap-qualified “full names” into Utils helpers to keep formula/cask name and tap extraction consistent across Homebrew commands, Bundle code, and migration/auditing paths.

Changes:

  • Add Utils.name_from_full_name and Utils.tap_from_full_name helpers plus unit tests.
  • Replace repeated split("/")/rpartition("/") parsing across commands, Bundle, and audit/diagnostic code with the helpers.
  • Minor cleanup in an RBI file (remove a stray trailing line).

Reviewed changes

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

Show a summary per file
File Description
Library/Homebrew/utils.rb Adds shared full-name parsing helpers (name_from_full_name, tap_from_full_name).
Library/Homebrew/test/utils_spec.rb Adds unit tests for the new parsing helpers.
Library/Homebrew/test/bundle/commands/cleanup_spec.rb Updates Bundle cleanup specs to use the helpers and requires utils.
Library/Homebrew/tap_auditor.rb Uses helper for extracting short names from tap-provided token/full-name lists.
Library/Homebrew/missing_formula.rb Refactors tap migration messaging to use helpers (introduces an uncovered edge-case).
Library/Homebrew/migrator.rb Uses helper to derive tap names from migration targets.
Library/Homebrew/linkage_checker.rb Uses helper to extract dependency names from possibly tap-qualified names.
Library/Homebrew/language/python.rb Uses helper when matching requirements/deps against the chosen Python dependency name.
Library/Homebrew/formulary.rb Uses helper for alias-table short-name extraction.
Library/Homebrew/formula.rb Uses helper when deriving aliases and enumerating tap formula/alias names.
Library/Homebrew/formula_auditor.rb Uses helper to compare dependency oldnames against dep short name.
Library/Homebrew/extend/hash/deep_transform_values.rbi Removes an extraneous trailing blank line.
Library/Homebrew/diagnostic.rb Uses helper to extract tap names for shadowed formula/cask reporting.
Library/Homebrew/dev-cmd/bottle.rb Uses helper to compute short formula name for bottle commit messages.
Library/Homebrew/descriptions.rb Uses helper to build a map of short names for display.
Library/Homebrew/dependency.rb Uses helper for option_names derived from dependency name.
Library/Homebrew/cmd/update-report.rb Uses helpers for rename/migration parsing in update report generation and migration actions.
Library/Homebrew/cmd/untap.rb Uses helper to match installed formulae/casks against tap entries (missing require "utils").
Library/Homebrew/cmd/leaves.rb Uses helper instead of local base-name parsing for dependency name extraction.
Library/Homebrew/cli/named_args.rb Uses helpers when raising tap-qualified unavailable errors.
Library/Homebrew/bundle/dsl.rb Uses helper in cask-name sanitization.
Library/Homebrew/bundle/cask.rb Uses helpers when checking installed taps and comparing cask names/oldnames.
Library/Homebrew/bundle/brew.rb Uses helpers in array checks, oldname/alias handling, and entry initialization.
Library/Homebrew/bundle/brew_services.rb Uses helper for base-name resolution when matching started services and old names.
Files not reviewed (1)
  • Library/Homebrew/extend/hash/deep_transform_values.rbi: Language not supported

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

- keep `full_name` parsing consistent across formula and cask code
- reduce repeated `split("/")` logic so tap and name extraction
  do not drift in commands, bundle code, and migrations
- cover `Utils.name_from_full_name` and
  `Utils.tap_from_full_name` in `test/utils_spec.rb`
@MikeMcQuaid MikeMcQuaid force-pushed the share-full-name-utils branch from 1a0eb3d to 3148d27 Compare April 9, 2026 16:13
@MikeMcQuaid MikeMcQuaid enabled auto-merge April 9, 2026 16:22
Copy link
Copy Markdown
Member

@ZhongRuoyu ZhongRuoyu left a comment

Choose a reason for hiding this comment

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

Nice cleanup, thanks!

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Apr 10, 2026
Merged via the queue into main with commit 3aae2a3 Apr 10, 2026
45 checks passed
@MikeMcQuaid MikeMcQuaid deleted the share-full-name-utils branch April 10, 2026 14:42
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