diff --git a/.travis.yml b/.travis.yml index 4840c9fed2..ced2573eba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,19 +48,10 @@ matrix: before_script: # Speed up build time by disabling Xdebug. - phpenv config-rm xdebug.ini || echo 'No xdebug config.' - # Set up temporary paths. - - export PHPCS_DIR=/tmp/phpcs - - export WPCS_DIR=/tmp/wpcs - - export PHPCOMPAT_DIR=/tmp/phpcompatibility - # Install CodeSniffer for WordPress Coding Standards checks. - - if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/squizlabs/PHP_CodeSniffer.git $PHPCS_DIR; fi - # Install WordPress Coding Standards. - - if [[ "$SNIFF" == "1" ]]; then git clone -b 0.14.1 --depth 1 https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git $WPCS_DIR; fi - # Install PHP Compatibility sniffs. - - if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/wimg/PHPCompatibility.git $PHPCOMPAT_DIR; fi - # Set install path for PHPCS sniffs. - # @link https://github.com/squizlabs/PHP_CodeSniffer/blob/4237c2fc98cc838730b76ee9cee316f99286a2a7/CodeSniffer.php#L1941 - - if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/bin/phpcs --config-set installed_paths $WPCS_DIR,$PHPCOMPAT_DIR; fi + # Install WordPress Coding Standards & PHP Compatibility sniffs. + - if [[ "$SNIFF" == "1" ]]; then composer global require wp-coding-standards/wpcs:~0.14.1 wimg/php-compatibility:dev-master dealerdirect/phpcodesniffer-composer-installer:^0.4.3 --prefer-stable --no-interaction --no-suggest; fi + # Set composer PATH. + - if [[ "$SNIFF" == "1" ]]; then export PATH=$HOME/.composer/vendor/bin:$PATH; fi # After CodeSniffer install you should refresh your path. - if [[ "$SNIFF" == "1" ]]; then phpenv rehash; fi # Install JSCS: JavaScript Code Style checker. @@ -87,7 +78,7 @@ script: # @link https://pear.php.net/package/PHP_CodeSniffer/ # Uses a custom ruleset based on WordPress. This ruleset is automatically # picked up by PHPCS as it's named `phpcs.xml(.dist)`. - - if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/bin/phpcs --runtime-set ignore_warnings_on_exit 1; fi + - if [[ "$SNIFF" == "1" ]]; then phpcs --runtime-set ignore_warnings_on_exit 1; fi # Receive notifications for build results. # @link https://docs.travis-ci.com/user/notifications/#Email-notifications