Skip to content

fix: family sorting#376

Merged
henryiii merged 2 commits into
mainfrom
henryiii/fix/sort
May 6, 2026
Merged

fix: family sorting#376
henryiii merged 2 commits into
mainfrom
henryiii/fix/sort

Conversation

@henryiii
Copy link
Copy Markdown
Collaborator

@henryiii henryiii commented May 6, 2026

This was not sorting correctly.

🤖 Assisted-by: Copilot:claude-sonnet-4.5

henryiii added 2 commits May 6, 2026 18:21
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>
@henryiii henryiii marked this pull request as ready for review May 6, 2026 22:50
@henryiii henryiii requested a review from Copilot May 6, 2026 22:50
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 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.

@henryiii henryiii merged commit 2891f68 into main May 6, 2026
17 checks passed
@henryiii henryiii deleted the henryiii/fix/sort branch May 6, 2026 23:04
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.

2 participants