Skip to content

Commit 33a0031

Browse files
committed
Add a command for execute quality script
1 parent 2d43297 commit 33a0031

File tree

6 files changed

+2348
-3
lines changed

6 files changed

+2348
-3
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
/.idea/
12
/vendor/
3+
.php-cs-fixer.cache
24
node_modules/
35
npm-debug.log
46
yarn-error.log
57

68
# Laravel 4 specific
79
bootstrap/compiled.php
8-
app/storage/
10+
quality/storage/
911

1012
# Laravel 5 & Lumen specific
1113
public/storage

README.md

+29-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,29 @@
1-
# quality_hook
2-
Only for change files execute both PHPCsFixer and PHPStan to your pre-commit hook
1+
# Quality Hook Installer
2+
3+
Install an execute script of specify quality tools to your git pre-commit hook, and it executes only for changed files
4+
## Install
5+
6+
```BASH
7+
composer global require kayw/quality-hook-installer
8+
```
9+
10+
## Usage
11+
12+
1. `quality run install --phpstan --php-cs-fixer`
13+
2. Execute `git add .` in your project.
14+
3. `git commit -m 'xxx'`
15+
4. The pre-commit hook will be triggered and the PHPStan and PHPCsFixer will execute only for changed files.
16+
17+
## Commands
18+
19+
The following command will execute quality inspection only for changed files
20+
21+
`quality run --phpstan --php-cs-fixer`
22+
23+
The following command will write in your pre-commit of git hook
24+
25+
`quality run install --phpstan --php-cs-fixer`
26+
27+
The following command will remove your pre-commit of git hook
28+
29+
`quality run uninstall`

composer.json

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "kayw/quality-hook-installer",
3+
"description": "Install an execute script of specify quality tools to your git pre-commit hook, and it executes only for changed files",
4+
"type": "composer-plugin",
5+
"license": "MIT",
6+
"autoload": {
7+
"psr-4": {
8+
"Kayw\\QualityHook\\": "src/"
9+
}
10+
},
11+
"authors": [
12+
{
13+
"name": "Kay Wei",
14+
"email": "weikaiii@sina.cn"
15+
}
16+
],
17+
"require-dev": {
18+
"symfony/console": "^6.1",
19+
"friendsofphp/php-cs-fixer":"*",
20+
"phpstan/phpstan":"*"
21+
},
22+
"config": {
23+
}
24+
}

0 commit comments

Comments
 (0)