Skip to content

chore: add pre-commit config mirroring the CI lint job - #85

Closed
aryansk wants to merge 2 commits into
shauryagangrade:mainfrom
aryansk:chore/pre-commit-config
Closed

chore: add pre-commit config mirroring the CI lint job#85
aryansk wants to merge 2 commits into
shauryagangrade:mainfrom
aryansk:chore/pre-commit-config

Conversation

@aryansk

@aryansk aryansk commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

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: three repo: local hooks 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: added pre-commit>=4.0 to the dev extras.
  • CONTRIBUTING.md: new "Pre-commit Hooks" section documenting uv run pre-commit install and uv run pre-commit run --all-files.

Acceptance criteria

  • pre-commit run --all-files passes on a clean tree — verified locally: ruff check, ruff format, and mypy all Passed (pre-commit 4.6.2).
  • CONTRIBUTING mentions the one-line install.

Validation

  • uv run pre-commit run --all-files → all hooks Passed.
  • git diff --check clean.

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.

@shauryagangrade shauryagangrade left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: system with uv run, so they depend on uv being 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 that uv sync --extra dev must be run first.
  • pass_filenames: false re-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.

@github-actions

Copy link
Copy Markdown

Hi @aryansk, thanks for the PR! It references #58, which is reserved for first-time contributors. Since you've already contributed here, please work on a different, unreserved issue instead. Closing without merging. Thanks!

@github-actions github-actions Bot closed this Aug 15, 2026
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.

[DevOps]: Add pre-commit config mirroring CI checks

2 participants