Skip to content

Add check-priority-monotone hook and fix priority ordering#1755

Merged
nathanjmcdougall merged 2 commits intomainfrom
copilot/add-hook-for-priority-groups
Apr 2, 2026
Merged

Add check-priority-monotone hook and fix priority ordering#1755
nathanjmcdougall merged 2 commits intomainfrom
copilot/add-hook-for-priority-groups

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 1, 2026

Priority groups in .pre-commit-config.yaml were non-monotone — ruff-format (priority 1) appeared before several priority 0 hooks (markdownlint-cli2, prettier, codespell, local check/export hooks), producing the sequence …0, 1, 0, 0, …, 0, 1, 1, 2, 2, 2.

Fix ordering

  • Split the ruff repo into two entries: ruff-check (p0) and ruff-format (p1)
  • Moved markdownlint-cli2, prettier, codespell before the p1 section
  • Split the local repo that mixed p0 and p1 hooks
  • Merged fix-readme + fix-doc-sync into one p1 local repo; deptry + import-linter + ty into one p2 local repo

Priority sequence is now 0,…,0, 1,1,1, 2,2,2.

New hook: check-priority-monotone

  • hooks/check-priority-monotone.py — extracts priority: values via regex, verifies the sequence is non-decreasing, reports exact line numbers on violation
  • General-purpose: accepts --config-file argument, no hard-coded paths
  • Wired at priority 0 in the local hooks block

…mmit-config.yaml

Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/ffe3c75a-bb73-47b5-b1c2-8f9b47c4622a

Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Copilot AI changed the title [WIP] Add a hook to check that priority groups are listed monotonely Add check-priority-monotone hook and fix priority ordering Apr 1, 2026
Copilot AI requested a review from nathanjmcdougall April 1, 2026 22:58
@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review April 1, 2026 23:04
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 1, 2026

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing copilot/add-hook-for-priority-groups (b0e0731) with main (3b8c7d2)

Open in CodSpeed

@nathanjmcdougall nathanjmcdougall merged commit c7f7f55 into main Apr 2, 2026
20 checks passed
@nathanjmcdougall nathanjmcdougall deleted the copilot/add-hook-for-priority-groups branch April 2, 2026 00:05
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.

Add a hook to check that priority groups are listed monotonely in the .pre-commit-config.yaml file

2 participants