8000 Document lint setup for contributors by JBloss1517 · Pull Request #332 · JWock82/Pynite · GitHub
[go: up one dir, main page]

Skip to content

Document lint setup for contributors - #332

Merged
JWock82 merged 1 commit into
mainfrom
document-lint-setup
Aug 4, 2026
Merged

JWock82 merged 1 commit into
mainfrom
document-lint-setup

Conversation

@JBloss1517
Copy link
Copy Markdown
Collaborator

Follow-up to #299, and should merge after it — the ## Linting section references ruff.toml and .pre-commit-config.yaml, which that PR adds.

#299 adds a lint CI check, but nothing tells contributors it exists. requirements.txt listed only pytest under # 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:

  • ruff and prek to the development requirements
  • A ## Linting section after ## Testing covering the hook install, running ruff directly, and a note that stock pre-commit works against the same config for anyone who already uses it

I verified every command against a tree with #299 merged in: prek install writes the hook, ruff check --fix . picks up ruff.toml, and committing a file with an unused import triggers the hook, which blocks the commit and reports the fix it made.

@codecov
codecov Bot commented Aug 3, 2026 •
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.35%. Comparing base (ff17a10) to head (aa8a604).

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           
Flag Coverage Δ
unittests 71.35% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread CONTRIBUTING.md Outdated
To run the checks yourself without the hook:

```bash
ruff check --fix .
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread requirements.txt Outdated

# Development
pytest
ruff
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.)

Comment thread requirements.txt Outdated
# Development
pytest
ruff
prek
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to d 8000 escribe this comment to others. Learn more.

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.
@JBloss1517
JBloss1517 force-pushed the document-lint-setup branch from 6a0caed to aa8a604 Compare August 4, 2026 16:52
@JBloss1517
JBloss1517 commented Aug 4, 2026 •
Copy link
Copy Markdown
Collaborator Author

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 prek run --all-files over ruff check --fix .: agreed, and the reasoning clicked once I thought past ruff. My version only invokes ruff, so as soon as the hook config grows a second tool, the documented manual command quietly becomes a partial check while still looking like the full one. I checked that prek run --all-files works without running prek install first, so it stands on its own. I've dropped the ruff check --fix . line rather than keep both.

On ruff in requirements.txt: dropped. The pinning point is what convinced me. prek installs its own ruff at v0.14.9 from .pre-commit-config.yaml, so an unpinned ruff sitting in requirements.txt would drift from that and report differently in an editor than on commit. Rather than carry a second version to keep in sync, I've added a line to the docs telling anyone who wants editor integration to match the pinned rev.

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 uv tool install prek, with pipx mentioned as an alternative, and confirmed it lands on PATH outside the project environment.

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.

@JWock82
JWock82 commented Aug 4, 2026
Copy link
Copy Markdown
Owner

@copilot please review this pull request for me. Also, flag any security vulnerabilities you see for me.

Copilot AI commented Aug 4, 2026
Copy link
Copy Markdown
Contributor

@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.

Copilot AI requested a review from JWock82 August 4, 2026 18:10
@JWock82
JWock82 merged commit 6500e19 into main Aug 4, 2026
5 checks passed
8D62
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.

4 participants

0