Merge pull request #17113 from woocommerce/add/travis-phpcs
Run PHPCS in Travis CI
This commit is contained in:
commit
c17e76adc8
|
@ -23,11 +23,13 @@ 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
|
||||
|
||||
script:
|
||||
- bash tests/bin/phpunit.sh
|
||||
- bash tests/bin/phpcs.sh
|
||||
|
||||
after_script:
|
||||
- bash tests/bin/travis.sh after
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
/**
|
||||
* WooCommerce Webhook functions
|
||||
*
|
||||
* @author WooThemes
|
||||
* @author Automattic
|
||||
* @category Core
|
||||
* @package WooCommerce/Functions
|
||||
* @version 2.3.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [[ $TRAVIS_PHP_VERSION == '7.1' ]]; then
|
||||
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
|
||||
fi
|
||||
fi
|
Loading…
Reference in New Issue