Skip to content

Commit 7337219

Browse files
committed
build: #5 lint when git pre commit
1 parent e4a398c commit 7337219

File tree

3 files changed

+67
-2
lines changed

3 files changed

+67
-2
lines changed

.git-pre-commit

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
git diff --diff-filter=d --name-only HEAD | xargs ./vendor/bin/phpcs --extensions=php --standard=PSR12

composer.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"require-dev": {
2525
"fakerphp/faker": "^1.14",
2626
"mockery/mockery": "^1.4.3",
27-
"phpunit/phpunit": "^9.5"
27+
"phpunit/phpunit": "^9.5",
28+
"squizlabs/php_codesniffer": "^3.6"
2829
},
2930
"autoload": {
3031
"psr-4": {
@@ -43,5 +44,10 @@
4344
},
4445
"minimum-stability": "stable",
4546
"prefer-stable": true,
47+
"scripts": {
48+
"post-install-cmd": [
49+
"php -r \"if (is_dir('.git/hooks/')) {copy('.git-pre-commit', '.git/hooks/pre-commit'); chmod('.git/hooks/pre-commit', 0755);}\""
50+
]
51+
},
4652
"bin": ["coding"]
4753
}

composer.lock

+57-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)