woocommerce/tests/bin/phpcs.sh

17 lines
514 B
Bash
Raw Normal View History

2017-10-09 20:31:15 +00:00
#!/usr/bin/env bash
if [[ ${RUN_PHPCS} == 1 ]]; then
2017-10-09 20:31:15 +00:00
CHANGED_FILES=`git diff --name-only --diff-filter=ACMR $TRAVIS_COMMIT_RANGE | grep \\\\.php | awk '{print}' ORS=' '`
IGNORE="tests/cli/,includes/libraries/,includes/api/legacy/"
2017-10-09 20:31:15 +00:00
2017-10-10 01:16:25 +00:00
if [ "$CHANGED_FILES" != "" ]; then
if [ ! -f "./vendor/bin/phpcs" ]; then
# Install wpcs globally
composer require woocommerce/woocommerce-sniffs
fi
2017-10-09 20:31:15 +00:00
echo "Running Code Sniffer."
./vendor/bin/phpcs --ignore=$IGNORE --encoding=utf-8 -s -n -p $CHANGED_FILES
2017-10-09 20:31:15 +00:00
fi
2017-10-10 12:34:47 +00:00
fi