Add default list of stages for pre-commit hook
authorVille Skyttä <ville.skytta@upcloud.com>
Tue, 22 Oct 2024 21:09:03 +0000 (00:09 +0300)
committerVille Skyttä <ville.skytta@iki.fi>
Tue, 22 Oct 2024 21:09:50 +0000 (00:09 +0300)
The pre-commit default of running in all possible stages is not quite
optimal for perltidy. Follow upstream advice:

https://pre-commit.com/#confining-hooks-to-run-at-certain-stages

> If you are authoring a tool, it is usually a good idea to provide an
> appropriate stages property. For example a reasonable setting for a
> linter or code formatter would be stages:
> [pre-commit, pre-merge-commit, pre-push, manual].

.pre-commit-hooks.yaml

index d0cdce588045cf9424a5c0adcb4db1f064afdf35..e71a3d995d748b669d9fa8428d661d1a8960496f 100644 (file)
@@ -1,8 +1,9 @@
 - id: perltidy
   name: perltidy
   description: Run the perltidy source code formatter on Perl source files
-  minimum_pre_commit_version: 2.1.0
   entry: perltidy --nostandard-output --backup-and-modify-in-place
   args: [--standard-error-output, --backup-file-extension=/]
   language: perl
   types: [perl]
+  stages: [pre-commit, pre-merge-commit, pre-push, manual]
+  minimum_pre_commit_version: 3.2.0 # for "new" names in stages