woocommerce/tests/bin/phpcs.sh

17 lines
539 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
2020-09-08 18:56:06 +00:00
composer global require woocommerce/woocommerce-sniffs --update-with-all-dependencies
fi
2017-10-09 20:31:15 +00:00
echo "Running Code Sniffer."
2020-09-08 19:53:13 +00:00
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