bitexpert / captainhook-infection
Captain Hook Plugin to run InfectionPHP only against the files of the current changeset
Installs: 5 086
Dependents: 6
Suggesters: 0
Security: 0
Stars: 9
Watchers: 4
Forks: 3
Open Issues: 0
Requires
- php: ^8.0.0|^8.1.0|^8.2.0
- captainhook/captainhook: ^5.12.0
Requires (Dev)
- captainhook/plugin-composer: ^5.3.3
- infection/infection: ^0.26.16
- madewithlove/license-checker: ^1.3
- phly/keep-a-changelog: ^2.12.1
- phpstan/extension-installer: ^1.2.0
- phpstan/phpstan: ^1.9.4
- phpstan/phpstan-phpunit: ^1.3.3
- phpstan/phpstan-strict-rules: ^1.4.4
- phpunit/phpunit: ^9.5.27
- roave/security-advisories: dev-latest
- squizlabs/php_codesniffer: ^3.7.1
This package is auto-updated.
Last update: 2024-11-06 10:26:12 UTC
README
This package provides an action for Captain Hook which will invoke InfectionPHP for all changed files of a commit. Running Infection only against the changed files will result in a faster execution of Infection which is ideal when running it as a pre-commit hook.
Installation
The preferred way of installing bitexpert/captainhook-infection
is through Composer.
You can add bitexpert/captainhook-infection
as a dev dependency, as follows:
composer.phar require --dev bitexpert/captainhook-infection
Usage
Add the following code to your captainhook.json
configuration file:
{
"pre-commit": {
"enabled": true,
"actions": [
{
"action": "\\bitExpert\\CaptainHook\\Infection\\InfectionAction"
}
]
}
}
By default, the action will invoke ./vendor/bin/infection
as a command. If you need to customize the path, e.g. because
you installed the .phar distribution you can do so by passing a infection
configuration option to the action.
{
"pre-commit": {
"enabled": true,
"actions": [
{
"action": "\\bitExpert\\CaptainHook\\Infection\\InfectionAction",
"options": {
"infection": "php infection.phar"
}
}
]
}
}
To pass additional parameters to Infection, e.g. to define the number of threads used by Infection, supply an args array option like this:
{
"pre-commit": {
"enabled": true,
"actions": [
{
"action": "\\bitExpert\\CaptainHook\\Infection\\InfectionAction",
"options": {
"args": [
"-j4"
]
}
}
]
}
}
Contribute
Please feel free to fork and extend existing or add new features and send a pull request with your changes! To establish a consistent code quality, please provide unit tests for all your changes and adapt the documentation.
Want To Contribute?
If you feel that you have something to share, then we’d love to have you. Check out the contributing guide to find out how, as well as what we expect from you.
License
Captain Hook Infection Action is released under the Apache 2.0 license.