Merge autopkgtest-cloud:pre-commit-changes into autopkgtest-cloud:master

Proposed by Brian Murray
Status: Merged
Merged at revision: b8cb722f190ad95f0d1184299811b5ebdd8b6a50
Proposed branch: autopkgtest-cloud:pre-commit-changes
Merge into: autopkgtest-cloud:master
Diff against target: 14 lines (+1/-2)
1 file modified
.pre-commit-config.yaml (+1/-2)
Reviewer Review Type Date Requested Status
Paride Legovini Approve
Review via email: mp+449766@code.launchpad.net

Description of the change

Using pre-commit run failed for me multiple times due to the naming of some of the stages - which looks like changed upstream (see new in 3.2.0 at https://pre-commit.com/#confining-hooks-to-run-at-certain-stages).

 $ pre-commit run
An error has occurred: InvalidConfigError:
==> File .pre-commit-config.yaml
==> At Config()
==> At key: repos
==> At Repository(repo='local')
==> At key: hooks
==> At Hook(id='pylint')
==> At key: stages
==> At index 5
=====> Expected one of commit, commit-msg, manual, merge-commit, post-checkout, post-commit, post-merge, post-rewrite, prepare-
commit-msg, push but got: 'pre-commit'
Check the log at /home/bdmurray/.cache/pre-commit/pre-commit.log

These changes allow pre-commit run to work for me locally. I'm not sure what will happen in Launchpad CI though.

To post a comment you must log in.
Revision history for this message
Tim Andersson (andersson123) wrote :

Looks like it's good in CI to me. LGTM but let's wait for Paride as he is the pre-commit wizard

Revision history for this message
Paride Legovini (paride) wrote (last edit ):

I'm slightly surprised as I thought I already used the new names. Checking...

Revision history for this message
Paride Legovini (paride) wrote :

My understanding of:

  new in 3.2.0: The values of stages match the hook names.
  Previously, commit, push, and merge-commit matched
  pre-commit, pre-push, and pre-merge-commit respectively.

is that the new names are those with the pre-*.

Which version of pre-commit is failing for you?

review: Needs Information
Revision history for this message
Brian Murray (brian-murray) wrote :

On Thu, Aug 24, 2023 at 03:06:53PM -0000, Paride Legovini wrote:
> Review: Needs Information
>
> My understanding of:
>
> new in 3.2.0: The values of stages match the hook names.
> Previously, commit, push, and merge-commit matched
> pre-commit, pre-push, and pre-merge-commit respectively.
>
> is that the new names are those with the pre-*.
>
> Which version of pre-commit is failing for you?

Ah, I'd misread which was new and old. I'm using `pre-commit version:
3.0.4` which is the version available as a .deb in Ubuntu 23.04.

--
Brian Murray

Revision history for this message
Paride Legovini (paride) wrote :

Given that newer pre-commit versions do not issue warnings when using the old stage names, and that this just works in CI, I'm fine with this diff. Or just upgrade to Mantic :-)

review: Approve
Revision history for this message
Brian Murray (brian-murray) wrote :

You never know what release a potential contributor might be running so let's use the stage names which work on the greatest number of releases.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
2index d3bc39f..56403eb 100644
3--- a/.pre-commit-config.yaml
4+++ b/.pre-commit-config.yaml
5@@ -31,8 +31,7 @@ repos:
6 name: pylint
7 stages:
8 [commit-msg, post-checkout, post-commit, post-merge, post-rewrite,
9- pre-commit, pre-merge-commit, pre-push, pre-rebase,
10- prepare-commit-msg]
11+ commit, merge-commit, push, prepare-commit-msg]
12 entry: pylint
13 args:
14 - "--disable=import-error"

Subscribers

People subscribed via source and target branches