https://github.com/phpple/gitwatcher
A Smart Git Hook Assembly.
https://github.com/phpple/gitwatcher
git hook
Last synced: about 1 month ago
JSON representation
A Smart Git Hook Assembly.
- Host: GitHub
- URL: https://github.com/phpple/gitwatcher
- Owner: phpple
- License: mit
- Created: 2020-02-23T13:55:01.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-05-08T01:17:37.000Z (about 5 years ago)
- Last Synced: 2025-07-26T02:48:31.102Z (10 months ago)
- Topics: git, hook
- Language: PHP
- Size: 70.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
## GitWatcher
GitWatcher is a assembly of git hook script.
If you want to use it, just add some script in your composer.json file.
```bash
composer require phpple/gitwatcher --dev
```
```
"scripts": {
"post-autoload-dump": [
"Phpple\\GitWatcher\\Composer::postAutoloadDump"
]
}
```
## Watchers
Your can find the watchers in `src/Watcher`
### git_version
Check whether the git's version greater than the custom version. The default mininum version is 2.2.0.
### committer
Check the validity of committer's information.For example, the committer's email's extension.
#### example
```json
{
"committer": {
"email_extension": "live.com"
}
}
```
Inspect will be failed when your local git config about user.email is not end with live.com.
### composer
Check the validity of `composer.json`.
#### example
```json
{
"composer": {}
}
```
Inspect will be failed when any repository's version of `require` field's is not a constant.
#### Illegal composer.json
```json
{
"require": {
"fideloper/proxy": "^4.3"
}
}
```
#### Good composer.json
```json
{
"require": {
"fideloper/proxy": "4.3.0"
}
}
```
### StandardWatcher
Check the validity of your code by phpcs.
#### example
```json
{
"standard": {
"phpcs": "vendor/bin/phpcs",
"target": "app/,src/",
"mode": "all",
"options": {
"standard": "{$project.root}assets/rules/phpdefault.xml",
"colors": true,
"s": true
}
}
}
```
* `phpcs`: where the phpcs bin file is
* `target`: the dir will be checked by phpcs
* `mode`: [all|update]
* `all`:check all the files in `target`
* `update`:only check update files in `target`
* `options`: the options of phpcs
* `standard`: `{$project.root}` refer to the root dir of gitwatcher.
* `colors`: print texts with color
* `s`: print the sniffer of the problem
* ... see the help of phpcs
## Custom configure
If your want to custom the configure, you can add a file(`gitwatcher.json`) in your site root dir. such as
```json
{
"@extend": "default",
"standard": {
"options": {
"colors": false
}
}
}
```