We’re currently moving the checks in Tools/patcheck to run via pre-commit in GH-109408 and related PRs.
In discussion, it has transpired that running make patchcheck (or python.bat Tools\patcheck\patcheck.py) locally performs several checks to remind contributors of what goes into a good PR, see the devguide for an overview of what is reported upon.
However, we don’t know how commonly patchcheck is used today, and if it makes sense to keep the tool, keep the checks but within a different tool, remove both, or something completely different.
To guage this, please may you indicate your typical behaviour in the following polls? Written notes are of course also welcome.
Using make patchcheck when preparing a PR
I typically use make patchcheck or python.bat Tools\patcheck\patcheck.py
I do not use make patchcheck or python.bat Tools\patcheck\patcheck.py
For the second question, I voted in affirmatively that “I think the checks that patchcheck uses are useful for contributors, including newer contributors”, but I think we should move the checks to pre-commit or similar, and these can be wrapped in a make command for ease of use.
As an extension for the third question, we can adapt make patchcheck to run all the lint checks: so it does all the patchcheck.py ones, plus the extra pre-commit checks. As we move checks from patchcheck.py to pre-commit, it would still run both.
And we could have make lint do the same as make patchcheck. Or make lint could just be the pre-commit things.
Thanks to Hugo for the (implicit) prompt, I realise I might not have explained this very well. The idea behind question 2 is to divorce the checks that patchcheck performs from the tool itself – if there’s consensus that the checks are useful but patchcheck is not, we could try and move them to some other venue, as Hugo alludes to.
I voted no on that question, because a number of the checks seem to be situational (has the documentation/test suite been updated, has misc/ACKS been updated). An automated check that can be ignored if you think it doesn’t apply tends to teach people to just ignore the check altogether, in my experience. So I think it’s a good checklist, but I’m not sure that translates well to them being good checks.
But I will admit I’m now confused because I don’t understand what “divorcing the checks from the tool” implies. If it includes “having a checklist in the devguide is useful and sufficient”, then I’m fine with that. If it means running some automated process and reporting “failures”, then I’m not so happy with it.
My “I don’t use it” and “I think the checks are useful” vote may seem contradictory, but it reflects my workflow: I rely heavily on CI - which is more natural now that Draft PRs are a thing so I don’t feel like I’m spamming people with unfinished work.
What I could potentially imagine as nicer than make patchcheck or make lint is actually make push… that runs meaningful checks that must pass prior to doing a git push of my branch to a git repo name of my choosing.
I think there is a discoverability issue. The last time I prepared a PR, I wanted to run those checks but I didn’t remember the spelling. There used to be an automatic reminder (was it back when using hg?) asking the user if they had run make patchcheck, which I think was quite useful.
I don’t know how git pre-commit hooks work, but if they are typically blocking, I would hate for a git commit to stall for seconds until a non-trivial command finishes running. Also, there are reasons to push a commit that does not validate all checks (for example to exercise some potential solution against CI).
No problem, the pre-commit tool can be run in two ways.
You can install it as an actual pre-commit hook, so it runs when you git commit, and will fail the commit if the checks fail. I have this enabled and really like it, but understand it’s not for everyone, so it definitely won’t be required for anyone.
The other way is to run it as a command-line tool, and run it on demand. This is what the CI does, and we can have a make command abstract away the flags and things to remember. It won’t run when you commit, and won’t slow down commits. You can then push and the let the CI do its thing.
(Aside: with pre-commit installed as a hook, you can git commit -n / --no-verify for it to skip the checks.)
A git integrated pre-hook like this would be ideal for me… because honestly i’m not in the habit of running make for anything other than the main build. (and will happily run whatever other tool for that step should our build system ever change)