Repository navigation
chore: fix the pre-commit hook - #314
Conversation
The pre-commit hook called docker-compose, php-cs-fixer and tlint (not a dependency) and was never installed. It now runs `composer lint`, the same Pint check CI runs, and cghooks installs it on composer install/update. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0bb92e5e11
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| "post-install-cmd": "cghooks add --ignore-lock", | ||
| "post-update-cmd": "cghooks update" |
There was a problem hiding this comment.
Guard hook setup during no-dev installs
When this repository is installed or updated with --no-dev, these event handlers still execute after Composer has omitted brainmaestro/composer-git-hooks, so cghooks is absent from PATH and the Composer command exits nonzero. This breaks clean dependency-only installations; Composer confirms that --no-dev prevents dev requirements from being installed, and the package maintainer recommends checking whether the binary exists before invoking it in these events in the upstream discussion. Guard both handlers when cghooks is unavailable.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 6f33175: both handlers now start with [ $COMPOSER_DEV_MODE -eq 0 ] ||, so --no-dev installs skip cghooks and exit 0, while dev installs still set up the hook.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6f33175b8d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| "post-install-cmd": "[ $COMPOSER_DEV_MODE -eq 0 ] || cghooks add --ignore-lock", | ||
| "post-update-cmd": "[ $COMPOSER_DEV_MODE -eq 0 ] || cghooks update" |
There was a problem hiding this comment.
Use a cross-platform dev-mode guard
On native Windows, both lifecycle handlers fail before hook setup because [ and $COMPOSER_DEV_MODE are POSIX-shell syntax rather than cmd.exe syntax. Composer executes string scripts through Process::fromShellCommandline and explicitly uses Windows command handling (Composer ProcessExecutor), so every composer install or composer update on Windows exits nonzero, including --no-dev runs. Use a PHP callback or another cross-platform guard instead.
Useful? React with 👍 / 👎.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ec0906064d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ] | ||
| } | ||
| }, | ||
| "scripts": { |
There was a problem hiding this comment.
The new scripts map contains only lifecycle handlers, so the advertised composer check command never runs Pint or PHPUnit. With Composer 2.9.7, composer help check instead resolves check to the built-in check-platform-reqs command (described as “Check that platform requirements are satisfied”), meaning the command can report success while formatting or tests fail; restore the lint, test, and composed check entries.
Useful? React with 👍 / 👎.
Why.
The pre-commit hook configured in
extra.hookswas never installed:composer-git-hooksis a plain library, so the hook reaches.git/hooksonly throughcghooks add, and nothing called it. If installed by hand it would fail:docker-compose.ymlhas nophpservice,tlintis not a dependency, andphp-cs-fixer fixdisagrees with Pint (which CI uses sinceea43d8e) on 3 files and leaves its fixes unstaged.What changed.
docker-compose run --rm -T nginx vendor/bin/pint --test, so no local PHP is needed.post-install-cmd/post-update-cmdinstall and update the hook throughcghooks; both skip it on--no-devinstalls, wherecghooksis absent.Verification.
composer validatepasses (only the existing warning about the unboundlaravel/frameworkconstraint).composer run-script --no-dev post-install-cmdexits 0 with the guard and fails with code 127 without it.🤖 Generated with Claude Code