phpple / gitwatcher
A Smart Git Hook Assembly.
Requires
- squizlabs/php_codesniffer: 3.5.4
Requires (Dev)
- composer/composer: ^1.10@dev
- phpunit/phpunit: 7.*
This package is not auto-updated.
Last update: 2024-11-06 23:47:30 UTC
README
GitWatcher is a assembly of git hook script.
If you want to use it, just add some script in your composer.json file.
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
{ "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
{
"composer": {}
}
Inspect will be failed when any repository's version of require
field's is not a constant.
Illegal composer.json
{ "require": { "fideloper/proxy": "^4.3" } }
Good composer.json
{ "require": { "fideloper/proxy": "4.3.0" } }
StandardWatcher
Check the validity of your code by phpcs.
example
{ "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 istarget
: the dir will be checked by phpcsmode
: [all|update]all
:check all the files intarget
update
:only check update files intarget
options
: the options of phpcsstandard
:{$project.root}
refer to the root dir of gitwatcher.colors
: print texts with colors
: 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
{ "@extend": "default", "standard": { "options": { "colors": false } } }