2017-10-09 20:31:15 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2017-11-21 20:09:07 +00:00
|
|
|
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=' '`
|
2019-06-28 13:20:30 +00:00
|
|
|
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
|
2020-08-11 23:08:28 +00:00
|
|
|
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."
|
2019-03-21 18:11:48 +00:00
|
|
|
./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
|