-
-
Notifications
You must be signed in to change notification settings - Fork 467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify, unify and document pre_push, CIs and pre-commit hooks to all use consistent tools, versions and config #1784
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! I have just a few suggestions.
.github/CONTRIBUTING.md
Outdated
and the pre-commit hooks, which ensure any new code conforms to PRAW's | ||
quality and style guidelines. To do so, install the linting dependencies | ||
with `pip install praw[lint]`, then by the hooks with `pre-commit install`. | ||
They will now run automatically every time you commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a comment about if there is things that are changed with pre-commit that the commit will fail and all that is needed to do is to commit again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great point. I was thinking of adding that, but wasn't sure how far I should go into the details. I'll add that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Let me know what you think.
Would you mind taking a look at this as well? I added a workflow to automatically update the versions but it failed. Not sure why prawcore needs to be installed to just update the versions. Thanks! |
f016b0d
to
25d8782
Compare
@LilSpazJoekp Sure. The action re-runs pre-commit on all files after updating the hooks to ensure that none of the updates introduced new checks that fail, as can often happen when new rules are added to linters or existing ones are modified. This allows you to handle them with the commit that introduces them. Otherwise, they will start failing on CI with the next unrelated PR, or with locally for any developer who touches the affected files, which is not a good developer UX and allows new issues to linger in the codebase until caught later. This includes running your Traceback (most recent call last):
[SNIP]
File "/home/runner/work/praw/praw/tools/check_documentation.py", line 10, in <module>
from praw.models.reddit.base import RedditBase # noqa: E402
File "/home/runner/work/praw/praw/praw/__init__.py", line 13, in <module>
from .reddit import Reddit # NOQA
File "/home/runner/work/praw/praw/praw/reddit.py", line 23, in <module>
from prawcore import (
ModuleNotFoundError: No module named 'prawcore' So, to resolve this, you could either:
|
25d8782
to
e0411b1
Compare
Looks like merging #1789 predictably created a conflict with this PR; I'll rebase, fix and confirm it doesn't break anything. Sorry for the delay on this that would otherwise have avoided that. |
e0411b1
to
a469bab
Compare
Thank you for helping with this! 🎇 |
Thanks for your support, review and feedback @LilSpazJoekp ! |
Followup to PR #1774 as requested by @LilSpazJoekp
Feature Summary and Justification
Per my comment on #1774 :
Significant changes:
pre_push.py
script instead of redundant manual invocations of each linter.pre_push.py
, useTemporaryDirectory
instead of the legacytempfile
API to further simplify the code and clean up the temp dir automaticallylint
extra and movepre-commit
there, where it belongspre_push.py
script; also update/remove a few other related obsolete mentionsappdirs
dependency. LilSpazJoekp/docstrfmt#30 ) that went undetected due to running different tools, versions and config via pre-commit, pre_push and CIs (as fixed in this PR)Also resulted in two PRs to fix further issues discovered with docstrfmt:
Thanks!