Fix the pre-push hook base resolution and align its PHPStan level with CI [no_release] - #637
Merged
Conversation
snake14
marked this pull request as draft
August 19, 2026 04:07
A higher level in the pre-push hook than in CI blocks pushes on pre-existing errors in touched files that CI accepts.
New files carry no pre-existing debt, so hold them to the strictest level.
…lease] Touched files are ratcheted up to level 5 even where the CI base is lower; pre-existing findings in a touched file get fixed with the change that touches it.
Uncommitted local changes were analyzed and could block a push for files the push doesn't contain. Also corrects the hook's log label.
Pushing another local branch, or several refs at once, analysed the checked-out branch instead of what was actually pushed.
A plugin cloned outside a Matomo checkout cannot be checked, which is no reason to block its pushes.
The ~85-line workflow is now maintained centrally in matomo-org/plugin-ci-workflows, so each caller passes only its plugin name and any dependent plugins. The PHP version comes from the shared default (matomo6_min_php), which is what this branch needs now that it targets 6.x-dev. Where a path is excluded that the shared workflow no longer creates - github-action-tests/ lived inside the plugin only because the old workflow checked it out there - it is marked optional, because PHPStan treats a missing excludePath as a fatal config error rather than a no-op.
snake14
force-pushed
the
PG-4897-hook-fixes
branch
from
August 27, 2026 05:11
a664a6b to
909de5a
Compare
The vendored copy predated the MAIN_BRANCH derivation, so on a 6.x-dev plugin it diffed against 5.x-dev, and it also lacked the ddev-running, NUL-safe-path and renamed-file fixes.
AltamashShaikh
approved these changes
Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow-up to #636: the pre-push hook now diffs against the merge base with
origin/5.x-devinstead of the local5.x-devbranch, which could be stale or missing and silently widened the analysis to files the push doesn't touch. It now fails with a clear message when the merge base can't be resolved.The modified-files hook level is set to the plugin-wide goal of level 5 (the CI base stays at level 1), so files a push touches ratchet toward that goal rather than staying at the level CI enforces.
Tooling-only change: no version bump or changelog entry (no_release).
Issue No
Related to PG-4897 (JIRA)
Steps to Replicate the Issue
5.x-devis stale or missing.Checklist