Skip to content

Enforce PHPCS on committed files before pushing - #648

Open
DarvinX wants to merge 8 commits into
quantacms:masterfrom
DarvinX:codex/enforce-pre-push-style
Open

DarvinX wants to merge 8 commits into
quantacms:masterfrom
DarvinX:codex/enforce-pre-push-style

Conversation

@DarvinX

@DarvinX DarvinX commented Oct 28, 2026

Copy link
Copy Markdown

Fixes #148.

The pre-push hook previously returned success even when PHP_CodeSniffer failed. It now checks the committed PHP and INC files introduced by each pushed ref and rejects pushes when those files fail the existing PSR-12 policy.

The checker uses temporary snapshots, so dirty working copies cannot hide a bad commit. It handles new branches, forks, multiple refs, renames, deleted files and unusual filenames, and gives setup guidance when PHP or PHPCS is missing. Composer scripts and the README document installation and manual checks. Untouched legacy style debt remains outside the push gate.

Validation, entirely inside Docker:

  • 23 regression checks with real Git and PHPCS 3.13.6, including accepted and rejected real pushes.
  • PHP/shell syntax, new checker style, and Composer validation passed. Composer reports the existing license/Jodit constraint warnings.

AI-assisted implementation, reviewed and tested before submission.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Coding Style fixing & git pre-push hook

1 participant