diff --git a/.travis.yml b/.travis.yml index fe6bb9b8133..9181bdd99eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/includes/wc-webhook-functions.php b/includes/wc-webhook-functions.php index 0dafe6a93d4..9883075b6c8 100644 --- a/includes/wc-webhook-functions.php +++ b/includes/wc-webhook-functions.php @@ -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. } /** diff --git a/tests/bin/phpcs.sh b/tests/bin/phpcs.sh new file mode 100755 index 00000000000..5a3a973cd6e --- /dev/null +++ b/tests/bin/phpcs.sh @@ -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