Skip to content

Commit 16da9ad

Browse files
committed
git hooks
1 parent e8b53d8 commit 16da9ad

File tree

3 files changed

+64
-4
lines changed

3 files changed

+64
-4
lines changed

.githooks/pre-commit

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env bash
2+
3+
PHP_CS_FIXER="vendor/bin/php-cs-fixer"
4+
PSALM="vendor/bin/psalm"
5+
6+
if [ ! -x $PHP_CS_FIXER ]; then
7+
echo ""
8+
echo "php-cs-fixer not found. Try:"
9+
echo ""
10+
echo " composer install"
11+
echo ""
12+
exit 1
13+
fi
14+
15+
if [ ! -x $PSALM ]; then
16+
echo ""
17+
echo "vimeo/psalm not found. Try:"
18+
echo ""
19+
echo " composer install"
20+
echo ""
21+
exit 1
22+
fi
23+
24+
FILES=`git status --porcelain | grep -E '^[AM] +(src|tests).*\.php$' | cut -c 4- | tr '\n' ' '`
25+
if [ -z "$FILES" ]; then
26+
echo "No php files found in commit."
27+
else
28+
output=`php -l ${FILES}`
29+
OUT=$?
30+
if [ $OUT != '0' ]; then
31+
echo "$output"
32+
echo ""
33+
echo "Please correct and recommit"
34+
35+
exit 1
36+
fi
37+
38+
$PHP_CS_FIXER fix --config=.php_cs.dist ${FILES} >/dev/null 2>&1
39+
git add ${FILES}
40+
41+
# output=`$PSALM --report=psalmCommitErrors.txt --config=psalmCommit.xml ${FILES} >/dev/null 2>&1`
42+
# OUT=$?
43+
# if [ $OUT != '0' ]; then
44+
# echo "PSALM Failed with the following errors:"
45+
# echo ""
46+
# cat psalmCommitErrors.txt
47+
# echo ""
48+
# echo "Please correct and recommit"
49+
#
50+
# exit 1
51+
# fi
52+
fi

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: composer
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
time: "10:00"
8+
open-pull-requests-limit: 10

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
],
1414
"require": {
1515
"php": ">=7.1",
16-
"rexxars/html-validator": ">=2.2",
17-
"phpfui/phpunit-syntax-coverage": "^1.0",
18-
"roave/you-are-using-it-wrong": "^1.8"
16+
"rexxars/html-validator": ">=2.2"
1917
},
2018
"require-dev": {
2119
"phpunit/phpunit": ">=7.0",
22-
"roave/security-advisories": "dev-latest"
20+
"phpfui/phpunit-syntax-coverage": ">=1.0",
21+
"roave/security-advisories": "dev-latest",
22+
"fabpot/php-cs-fixer": "dev-master"
2323
},
2424
"autoload": {
2525
"psr-0": {"PHPFUI": "src/"}

0 commit comments

Comments
 (0)