woocommerce/tests/bin/phpcs.sh

21 lines
550 B
Bash
Raw Normal View History

2017-10-09 20:31:15 +00:00
#!/usr/bin/env bash
if [[ $TRAVIS_PHP_VERSION == '7.1' ]]; then
composer install
CHANGED_FILES=`git diff --name-only --diff-filter=ACMR $TRAVIS_COMMIT_RANGE | grep \\\\.php | awk '{print}' ORS=' '`
IGNORE="tests/cli/,apigen/,includes/gateways/simplify-commerce/includes/,includes/libraries/,includes/api/legacy/"
if [ "$CHANGED_FILES" != "" ]
then
echo "Running Code Sniffer."
./vendor/bin/phpcs --ignore=$IGNORE --standard=./phpcs.ruleset.xml --encoding=utf-8 -n -p $CHANGED_FILES
if [ $? != 0 ]
then
exit 1
fi
fi
exit $?
if