| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…-commit's trailing-whitespace
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
There was a problem hiding this comment.
LGTM (though I can't review the Makefile changes :)
Sorry, something went wrong.
| @$(RUNSHARED) ./$(BUILDPYTHON) -m pre_commit --version >/dev/null 2>&1 || $(RUNSHARED) ./$(BUILDPYTHON) -m pip install pre-commit >/dev/null 2>&1 | ||
| $(RUNSHARED) ./$(BUILDPYTHON) -m pre_commit run --all-files |
There was a problem hiding this comment.
I don't think make patchcheck should run pre commit, especially if the goal is to remove it. Hence I'd say this is a docs point to communicate.
| @$(RUNSHARED) ./$(BUILDPYTHON) -m pre_commit --version >/dev/null 2>&1 || $(RUNSHARED) ./$(BUILDPYTHON) -m pip install pre-commit >/dev/null 2>&1 | |
| $(RUNSHARED) ./$(BUILDPYTHON) -m pre_commit run --all-files |
Sorry, something went wrong.
There was a problem hiding this comment.
I'm thinking it would be a good idea to add a make lint target like we have for the PEPs repo (and Pillow), which seems to work there.
Perhaps we should add make lint now and have it run pre-commit; and maybe also patchcheck?
Sorry, something went wrong.
There was a problem hiding this comment.
I'd agree. We should also update the devguide (currently only patchcheck is mentioned)
Sorry, something went wrong.
There was a problem hiding this comment.
I've removed the Makefile changes from this PR, let's decide what to later after discussion:
https://discuss.python.org/t/do-you-use-make-patchcheck/34743?u=hugovk
Sorry, something went wrong.
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
There was a problem hiding this comment.
Right now Makefile does not have pip mentions at all, I think that adding a new target with external deps needs a bit of discussion.
Since Makefile has a biiig range of different use-cases.
In my opinion having pre-commit CLI and in CI on its own is good enough.
Sorry, something went wrong.
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
To clarify my opinion: I don't mind which of either of these are used, as I use Windows so the choice is personally irrelevant! I'll be happy with whatever Hugo goes for. A |
Sorry, something went wrong.
|
We could perhaps create a poll on Discourse in the core development category asking how many people actually run make patchcheck. If the answer is zero (or very few), then that simplifies the decisions that need to be here — we can just get rid of it from the Makefile |
Sorry, something went wrong.
|
Written up some questions at https://discuss.python.org/t/do-you-use-make-patchcheck/34743 A |
Sorry, something went wrong.
|
Thanks @hugovk for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
Sorry, something went wrong.
…-commit (pythonGH-109854) (cherry picked from commit 7426ed0) Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
…-commit (pythonGH-109854) (cherry picked from commit 7426ed0) Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
|
GH-110594 is a backport of this pull request to the 3.12 branch. |
Sorry, something went wrong.
|
GH-110595 is a backport of this pull request to the 3.11 branch. |
Sorry, something went wrong.
…e-commit (GH-109854) (#110595) gh-109408: Add the docs whitespace check from patchcheck to pre-commit (GH-109854) (cherry picked from commit 7426ed0) Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
…e-commit (GH-109854) (#110594) gh-109408: Add the docs whitespace check from patchcheck to pre-commit (GH-109854) (cherry picked from commit 7426ed0) Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
…-commit (python#109854) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
| Back | FazBrowse Home | New Git URL |
Moves one of the patchcheck checks to pre-commit.
1.
patchcheck's normalize_docs_whitespace runs on files where fn.startswith('Doc') and fn.endswith(('.rst', '.inc')
pre-commit's trailing-whitespace is already running on c, python and rst in the whole codebase.
So this widens the check to cover inc files in the whole codebase, not just in Doc. I think this is a good thing.
2.
patchcheck substitutes matches of re.compile(br'\s+(\r?\n)$') with br'\1. That is, it strips multiple trailing \r and \n characters.
pre-commit's trailing-whitespace trims all trailing whitespace by default (docs). This also widens the check, I think this is a good thing.
3.
Remove docs_modified(doc_files) from patchcheck, it merely printed out whether any docs files were modified. I don't think it's useful now patcheck does no docs checking, and I'd like to eventually remove patchcheck.
4.
Some people might be still running make patchcheck? If so, to maintain some kind of parity, I've added steps to install and run pre-commit as part of the Makefile command.
We're doing a similar thing in the PEPs repo:
https://github.com/python/peps/blob/a159a9ac58ca73dc1da0b626b6df77807af455d0/Makefile#L62-L77
(And Pillow: https://github.com/python-pillow/Pillow/blob/main/Makefile)
Does this seem useful, or better to leave it out?
5.
Finally, some cleanup of patchcheck.py: whitespace, f-strings, consistent pluralised outputs, fix typo.