Repository navigation
Document lint setup for contributors - #332
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #332 +/- ##
=======================================
Coverage 71.35% 71.35%
=======================================
Files 23 23
Lines 9960 9960
=======================================
Hits 7107 7107
Misses 2853 2853
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| To run the checks yourself without the hook: | ||
|
|
||
| ```bash | ||
| ruff check --fix . |
There was a problem hiding this comment.
I'd recommend prek run or prek run --all-files here to keep it compatible in future with potential new tools in git hooks config.
|
|
||
| # Development | ||
| pytest | ||
| ruff |
There was a problem hiding this comment.
If https://github.com/JWock82/Pynite/pull/332/changes#r3710318815 recommends using prek/pre-commit, this is not needed for local manual runs (but can still be useful for IDE integrations. In that case, I'd recommend pinning the version.)
| # Development | ||
| pytest | ||
| ruff | ||
| prek |
There was a problem hiding this comment.
I prefer installing it system wide so git UIs/GUIs don't need to activate the environment to run the hooks.
Adds a `## Linting` section to CONTRIBUTING.md covering installing prek, setting up the git hook, and running the checks across the repository. Without this, a contributor can clone, commit, and get a red `lint` check from tooling they were never pointed at, with no local hook installed.
6a0caed to
aa8a604
Compare
|
Thanks for these, all three are going in. I should say up front that I'm new to prek and pre-commit generally, so this is genuinely useful rather than a style preference I'm politely conceding. At least one of these I would not have worked out on my own. On On On installing prek system wide: this is the one I'd missed entirely, and it's a real failure mode rather than a preference. I hadn't considered that hooks fired from a git GUI don't activate the virtualenv, so a venv-only prek would just silently not run. I've switched the docs to Net effect is that requirements.txt drops out of this PR entirely, so it's now CONTRIBUTING.md only. Your three comments deleted half the PR and improved it, which I appreciate. |
|
@copilot please review this pull request for me. Also, flag any security vulnerabilities you see for me. |
I reviewed the PR changes and checked for security issues. There are no code or dependency changes in this PR (docs-only update to CONTRIBUTING.md), and I did not find any security vulnerabilities in the submitted changes. |
Follow-up to #299, and should merge after it — the
## Lintingsection referencesruff.tomland.pre-commit-config.yaml, which that PR adds.#299 adds a
lintCI check, but nothing tells contributors it exists.requirements.txtlisted onlypytestunder# Development, and CONTRIBUTING.md had no linting section at all. As it stands someone can clone, commit, and get a red check from tooling they were never pointed at, with no local hook installed.This adds:
ruffandprekto the development requirements## Lintingsection after## Testingcovering the hook install, running ruff directly, and a note that stockpre-commitworks against the same config for anyone who already uses itI verified every command against a tree with #299 merged in:
prek installwrites the hook,ruff check --fix .picks upruff.toml, and committing a file with an unused import triggers the hook, which blocks the commit and reports the fix it made.