Adds PHPCS in Travis CI
This commit is contained in:
parent
87cf8f4809
commit
ab04636ef0
|
@ -23,6 +23,7 @@ matrix:
|
|||
|
||||
before_script:
|
||||
- export PATH="$HOME/.composer/vendor/bin:$PATH"
|
||||
- if [[ $TRAVIS_PHP_VERSION == '7.1' ]]; then composer install; fi
|
||||
- bash tests/bin/install.sh woocommerce_test root '' localhost $WP_VERSION
|
||||
- bash tests/bin/travis.sh before
|
||||
|
||||
|
@ -31,3 +32,4 @@ script:
|
|||
|
||||
after_script:
|
||||
- bash tests/bin/travis.sh after
|
||||
- bash tests/bin/phpcs.sh
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
#!/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
|
Loading…
Reference in New Issue