-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathphpcodesniffer
More file actions
executable file
·34 lines (25 loc) · 824 Bytes
/
phpcodesniffer
File metadata and controls
executable file
·34 lines (25 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
cd "$( cd "$( dirname "$0" )" && pwd )" || exit 1
DIR="`pwd`"
function exit_error
{
echo >&2 "ERROR: $@"
exit 1
}
# Run PHP linter
find . -type f -iname "*.php" -not -path "./vendor/*" -print0 | while IFS= read -r -d $'\0' file; do
php -lf $file > /dev/null
[ $? -eq 0 ] || exit_error "$file needs to be fixed to continue"
done
# Install/update https://github.com/wimg/PHPCompatibility
cd vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/ || exit_error "PHP_CodeSniffer not installed"
if [ -d PHPCompatibility ]; then
cd PHPCompatibility
git pull -q
else
git clone http://github.com/wimg/PHPCompatibility.git -q
fi
# Run PHP_CodeSniffer
cd "$DIR"
./vendor/bin/phpcs --report-width=100 --tab-width=4 --standard=phpcodesniffer.xml,PHPCompatibility src/ -as --runtime-set testVersion 5.4
exit 0