Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bitExpert/captainhook-infection
Captain Hook Plugin to run InfectionPHP only against the changed files of a commit
https://github.com/bitExpert/captainhook-infection
captainhook git githook php
Last synced: about 8 hours ago
JSON representation
Captain Hook Plugin to run InfectionPHP only against the changed files of a commit
- Host: GitHub
- URL: https://github.com/bitExpert/captainhook-infection
- Owner: bitExpert
- License: apache-2.0
- Created: 2021-01-30T15:28:37.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-06T09:09:40.000Z (7 months ago)
- Last Synced: 2024-09-20T12:08:35.775Z (about 2 months ago)
- Topics: captainhook, git, githook, php
- Language: PHP
- Homepage:
- Size: 101 KB
- Stars: 9
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# bitexpert/captainhook-infection
This package provides an action for [Captain Hook](https://github.com/CaptainHookPhp/captainhook)
which will invoke [InfectionPHP](https://infection.github.io) 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.[![Build Status](https://github.com/bitExpert/captainhook-infection/workflows/ci/badge.svg?branch=master)](https://github.com/bitExpert/captainhook-infection/actions)
[![Coverage Status](https://coveralls.io/repos/github/bitExpert/captainhook-infection/badge.svg?branch=master)](https://coveralls.io/github/bitExpert/captainhook-infection?branch=master)
[![Mastodon Follow](https://img.shields.io/mastodon/follow/109408681246972700?domain=https://rheinneckar.social)](https://rheinneckar.social/@bitexpert)## 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](CONTRIBUTING.md) 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.