fix: family sorting#376
Merged
Merged
Conversation
The to_html function was iterating over families in insertion order (from entry points) rather than by their configured order values. This caused validate-pyproject to appear at the top of the output instead of at the bottom where it should be (with other order=0 families, sorted alphabetically). Now families are properly sorted by: 1. Order value (ascending) 2. Family name (alphabetically within same order) This ensures families like 'general' (-3) and 'pyproject' (-2) appear at the top, followed by default order families alphabetically. Add test for family sorting in HTML output Test verifies that families are sorted correctly in HTML output by: 1. Order value (ascending) 2. Family name (alphabetically within same order) This ensures the fix for validate-pyproject appearing out of order is covered by tests and won't regress. Assisted-by: Copilot:claude-kaiku-4.5 Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
Assisted-by: Copilot:GPT-5.3-Codex Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the ordering of “families” in repo-review outputs so they are displayed deterministically based on each family’s configured order value, then alphabetically by the family key (matching the documented behavior).
Changes:
- Added
sort_family_keys()helper to centralize family key sorting logic. - Updated HTML and Rich output to iterate families using the new sorted order.
- Ensured JSON output includes families in the same sorted order, and added tests covering both HTML ordering and the sorting helper.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/test_families.py | Adds tests asserting stable family ordering in HTML output and for the new sorting helper. |
| src/repo_review/html.py | Switches family iteration to use sort_family_keys() for deterministic ordering in HTML reports. |
| src/repo_review/families.py | Introduces sort_family_keys() and exports it as part of the module’s public surface. |
| src/repo_review/main.py | Applies sorted family ordering to Rich output and stabilizes JSON families ordering. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This was not sorting correctly.
🤖 Assisted-by: Copilot:claude-sonnet-4.5