Skip to content

Fix the pre-push hook base resolution and align its PHPStan level with CI [no_release] - #637

Open
snake14 wants to merge 7 commits into
5.x-devfrom
PG-4897-hook-fixes
Open

Fix the pre-push hook base resolution and align its PHPStan level with CI [no_release]#637
snake14 wants to merge 7 commits into
5.x-devfrom
PG-4897-hook-fixes

Conversation

@snake14

@snake14 snake14 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Description

Follow-up to #636: the pre-push hook now diffs against the merge base with origin/5.x-dev instead of the local 5.x-dev branch, 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.

  • Newly created files are now checked at PHPStan level 9: new code carries no pre-existing debt, so it is held to the strictest level.

Tooling-only change: no version bump or changelog entry (no_release).

Issue No

Related to PG-4897 (JIRA)

Steps to Replicate the Issue

  1. Push a branch from a checkout whose local 5.x-dev is stale or missing.
  2. Expected: the pre-push hook analyses only the files the push touches.
  3. Actual: the hook diffed against the stale local branch and analysed unrelated files, or failed to resolve the branch entirely.

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)
  • [NA] 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?

snake14 added 2 commits August 4, 2026 10:15
A higher level in the pre-push hook than in CI blocks pushes on pre-existing
errors in touched files that CI accepts.
@snake14 snake14 changed the title Diff against the merge base with origin/5.x-dev in the pre-push hook [no_release] Fix the pre-push hook base resolution and align its PHPStan level with CI [no_release] Aug 3, 2026
snake14 added 2 commits August 4, 2026 11:47
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.
@snake14
snake14 requested a review from a team August 4, 2026 01:06
snake14 added 3 commits August 4, 2026 13:52
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.
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.

1 participant