Skip to content

Commit f7b0f52

Browse files
committed
Upgrade module version
1 parent 5a43f86 commit f7b0f52

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

.githooks/pre-commit

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/sh
2+
PROJECT=`php -r "echo dirname(dirname(realpath('$0')));"`
3+
STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php`
4+
echo $PROJECT
5+
# Determine if a file list is passed
6+
if [ "$#" -eq 1 ]
7+
then
8+
oIFS=$IFS
9+
IFS='
10+
'
11+
SFILES="$1"
12+
IFS=$oIFS
13+
fi
14+
15+
SFILES=${SFILES:-$STAGED_FILES_CMD}
16+
17+
echo "Checking PHP Lint..."
18+
for FILE in $SFILES
19+
do
20+
php -l -d display_errors=0 $PROJECT/$FILE
21+
if [ $? != 0 ]
22+
then
23+
echo -e "\033[41m"Fix the error before commit."\033[0m"
24+
exit 1
25+
fi
26+
FILES="$FILES $PROJECT/$FILE"
27+
done
28+
29+
if [ "$FILES" != "" ]
30+
then
31+
32+
echo -e "\033[0;32m"Running Code Sniffer..."\033[0m"
33+
./vendor/bin/phpcs --standard=EcgM2,PSR2,Magento2 --encoding=utf-8 -p $FILES
34+
35+
if [ $? != 0 ]
36+
then
37+
echo -e "\033[41m"Fix the error before commit."\033[0m"
38+
exit 1
39+
fi
40+
41+
echo -e "\033[0;32m"Recovering your stashed code..."\033[0m"
42+
43+
fi
44+
45+
exit $?

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"homepage": "https://github.com/magento-ecg/coding-standard",
55
"license": "MIT",
66
"type": "phpcodesniffer-standard",
7+
"version": "4.0",
78
"authors": [
89
{
910
"name": "Magento Expert Consulting Group",

0 commit comments

Comments
 (0)