Repository navigation
sort search results by version - #24240
Merged
Merged
Conversation
Contributor
Contributor
There was a problem hiding this comment.
🧹 Nitpick comments (1)
Library/Homebrew/search.rb (1)
97-101: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd a regression assertion for numeric version ordering.
The
#search_formulaeexamples only usetestballand assert annotations or installed status. A revert to lexical.sortwould pass them while placingpython@3.12beforepython@3.9. Add a focused ordering example.Suggested fix
it "does not annotate normal formulae" do expect(described_class.search_formulae(/testball/)).to eq(["testball"]) end + it "sorts versioned formulae by numeric version" do + formula_312 = instance_double(Formula, full_name: "python@3.12", any_version_installed?: false, + valid_platform?: true, deprecated?: false, disabled?: false, + pinned?: false, requirements: [], deps: [], + runtime_installed_formula_dependents: [], stable: nil, head: nil, + pour_bottle?: true) + formula_39 = instance_double(Formula, full_name: "python@3.9", any_version_installed?: false, + valid_platform?: true, deprecated?: false, disabled?: false, + pinned?: false, requirements: [], deps: [], + runtime_installed_formula_dependents: [], stable: nil, head: nil, + pour_bottle?: true) + allow(Formula).to receive_messages(full_names: ["python@3.12", "python@3.9"], alias_full_names: []) + allow(Formulary).to receive(:factory).with("python@3.12").and_return(formula_312) + allow(Formulary).to receive(:factory).with("python@3.9").and_return(formula_39) + allow(Tab).to receive(:for_formula).with(formula_312).and_return(tab) + allow(Tab).to receive(:for_formula).with(formula_39).and_return(tab) + + expect(described_class.search_formulae(/python/)).to eq(["python@3.9", "python@3.12"]) + end + it "shows only the installed icon for installed formulae" do allow(formula).to receive_messages(any_version_installed?: true, pinned?: true)
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
78f18557-b8d9-494b-8f72-787bb5dbe476
📒 Files selected for processing (1)
Library/Homebrew/search.rb
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📜 Review details
⏰ Context from checks skipped due to timeout. (19)
- GitHub Check: docker (arm64 Ubuntu 24.04)
- GitHub Check: docker (x86_64 Ubuntu 26.04)
- GitHub Check: docker (arm64 Ubuntu 26.04)
- GitHub Check: docker (x86_64 Ubuntu 24.04)
- GitHub Check: tests (Linux, 2/2)
- GitHub Check: tests (load-only Linux)
- GitHub Check: tests (load-only macOS)
- GitHub Check: tests (generic OS, 1/2)
- GitHub Check: tests (Linux, 1/2)
- GitHub Check: tests (no Sorbet)
- GitHub Check: tests (online, 1/2)
- GitHub Check: tests (macOS, 2/2)
- GitHub Check: tests (generic OS, 2/2)
- GitHub Check: tests (online, 2/2)
- GitHub Check: tests (macOS, 1/2)
- GitHub Check: syntax
- GitHub Check: workflow_syntax
- GitHub Check: docs
- GitHub Check: Analyze
🔇 Additional comments (1)
Library/Homebrew/search.rb (1)
97-101: LGTM!
Sort search results by version, so that "python@3.9" sorts ahead of "python@3.12".
adamv
force-pushed
the
feature/sort-version-tags
branch
from
October 12, 2026 17:38
bc5728b to
04a6532
Compare
MikeMcQuaid
approved these changes
Oct 12, 2026
MikeMcQuaid
left a comment
Member
There was a problem hiding this comment.
Nice idea, makes sense to me, thanks @adamv!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For consideration:
Sort search results by version, so that "python@3.9" sorts ahead of "python@3.12".
brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?