chore: add pre-commit config mirroring the CI lint job - #85
Closed
aryansk wants to merge 2 commits into
Closed
Conversation
The test job already runs coverage and uploads .coverage artifacts, but no one aggregates or publishes the numbers. Emit coverage.xml in the test job and upload it with codecov/codecov-action (fail_ci_if_error: false so CI stays green until the Codecov token or app is configured), gitignore the generated file, and add the Codecov badge to the README next to the build badge. Fixes shauryagangrade#64.
CI enforces ruff check/format and mypy, but there was no local hook, so contributors only learned about violations after pushing. Add a .pre-commit-config.yaml with local hooks that run the exact CI commands (uv run ruff check ., uv run ruff format --check ., uv run mypy gcode), add pre-commit to the dev extras, and document the one-line install in CONTRIBUTING. Fixes shauryagangrade#58.
4 tasks
shauryagangrade
approved these changes
Aug 15, 2026
shauryagangrade
left a comment
Owner
There was a problem hiding this comment.
Nice addition: the pre-commit hooks mirror the CI lint job exactly (ruff check, ruff format, mypy), and CONTRIBUTING + dev dependency updates make it discoverable.
Notes (non-blocking):
- The hooks use
language: systemwithuv run, so they depend onuvbeing installed and the venv synced (uv sync --extra dev) — reasonable for this repo, and it guarantees the same tool versions as CI. Worth a one-line note in CONTRIBUTING thatuv sync --extra devmust be run first. pass_filenames: falsere-lints the whole tree on every commit; slightly slower, but exactly mirrors CI. Fine.- Stacking: this PR also carries the codecov CI/README/gitignore change from #84 (and #86 inherits both). After #84 merges, rebase this one so only the pre-commit hunk remains.
Approve — ready once you mark the PR ready for review.
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.
Closes #58.
Problem
CI enforces ruff lint/format and mypy, but there was no local hook, so contributors only learned about violations after pushing (each CI run ~1–2 min).
Change
.pre-commit-config.yaml: threerepo: localhooks that run the exact CI commands (uv run ruff check .,uv run ruff format --check .,uv run mypy gcode) so there is no version drift between local and CI.pyproject.toml: addedpre-commit>=4.0to thedevextras.CONTRIBUTING.md: new "Pre-commit Hooks" section documentinguv run pre-commit installanduv run pre-commit run --all-files.Acceptance criteria
pre-commit run --all-filespasses on a clean tree — verified locally: ruff check, ruff format, and mypy allPassed(pre-commit 4.6.2).Validation
uv run pre-commit run --all-files→ all hooks Passed.git diff --checkclean.