Skip to content

Ship the shared pre-push hook [ignore_release] - #95

Merged
snake14 merged 1 commit into
6.x-devfrom
add-prepush-hook
Sep 17, 2026
Merged

snake14 merged 1 commit into
6.x-devfrom
add-prepush-hook

Conversation

@snake14

@snake14 snake14 commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Description

Adds the shared pre-push hook, which runs PHPStan over the PHP files a push touches so an analysis failure surfaces before CI rather than after it. The file is a byte-identical copy of hooks/pre-push in matomo-org/plugin-ci-workflows (blob 7d06e117), and verify-hook: true turns on the Plugins CI job that diffs it against that canonical copy, so it cannot drift silently.

The hook dispatches on phpstan/phpstan.created.neon and phpstan/phpstan.modified.neon and analyses nothing at all without them, so both ship alongside it. Created files are held at level 9, since a new file carries no pre-existing debt; touched files at level 5. Both include the plugin's existing phpstan.neon, so CI is unaffected.

Note that shipping the hook does not by itself switch it on: it runs only once core.hooksPath points at .git-hooks-matomo in a given clone, which add-git-hooks-to-plugins.sh does for plugins that already have the directory.

Issue No

Related to PG-4897

Steps to Replicate the Issue

Not applicable — this adds tooling rather than fixing a defect.

Checklist

  • [✔] Tested locally or on demo2/demo3?
  • [NA] New test case added/updated?
  • [NA] Are all newly added texts included via translation?
  • [NA] Are text sanitized properly? (Eg use of v-text v/s v-html for vue)
  • [✖] Version bumped?
  • [✔] I have understood, reviewed, and tested all AI outputs before use
  • [✔] All AI instructions respect security, IP, and privacy rules
  • [NA] Documentation updated?

Byte-identical to hooks/pre-push in matomo-org/plugin-ci-workflows, with
verify-hook turned on so the copy cannot drift from it silently. The hook
dispatches on phpstan/phpstan.created.neon and phpstan.modified.neon and
silently analyses nothing without them, so both ship alongside it.
@snake14
snake14 requested a review from a team September 16, 2026 23:25
@snake14
snake14 enabled auto-merge (squash) September 16, 2026 23:34
@snake14
snake14 merged commit 01cb5b4 into 6.x-dev Sep 17, 2026
24 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants