From f3f657df997e79045733dfb450a57376bbe97cf7 Mon Sep 17 00:00:00 2001 From: IanDelMar <42134098+IanDelMar@users.noreply.github.com> Date: Tue, 17 Dec 2019 00:07:10 +0100 Subject: [PATCH] Fixes travis config file Fixes the mess due to #995 and #1005. Fixes: * Remove --standard - codesniffer.ruleset.xml was renamed to phpcs.xml which gets picked automatically by PHPCS. * Install PHP Compatibility sniffs. * Add PHP Compatibility to install path for PHPCS sniffs. --- .travis.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5a99f20..80de718 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,6 +29,10 @@ env: # e.g. copy database configurations, environment variables, etc. # Failures in this section will result in build status 'errored'. before_script: + # Set up temporary paths. + - export PHPCS_DIR=/tmp/phpcs + - export WPCS_DIR=/tmp/wpcs + - export PHPCOMPAT_DIR=/tmp/phpcompatibility # Set up WordPress installation. - export WP_DEVELOP_DIR=/tmp/wordpress/ - mkdir -p $WP_DEVELOP_DIR @@ -49,14 +53,14 @@ before_script: # Create WordPress database. #- mysql -u root -e "CREATE DATABASE wordpress_test;" # Install CodeSniffer for WordPress Coding Standards checks. - - mkdir php-codesniffer && curl -L https://github.com/squizlabs/PHP_CodeSniffer/archive/3.5.0.tar.gz | tar xz --strip-components=1 -C php-codesniffer + - git clone -b master --depth 1 https://github.com/squizlabs/PHP_CodeSniffer.git $PHPCS_DIR # Install WordPress Coding Standards. - - mkdir wordpress-coding-standards && curl -L https://github.com/WordPress/WordPress-Coding-Standards/archive/2.1.1.tar.gz | tar xz --strip-components=1 -C wordpress-coding-standards - # Hop into CodeSniffer directory. - - cd php-codesniffer - # Set install path for WordPress Coding Standards + - git clone -b master --depth 1 https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git $WPCS_DIR + # Install PHP Compatibility sniffs. + - git clone -b master --depth 1 https://github.com/wimg/PHPCompatibility.git $PHPCOMPAT_DIR + # Set install path for PHPCS sniffs. # @link https://github.com/squizlabs/PHP_CodeSniffer/blob/4237c2fc98cc838730b76ee9cee316f99286a2a7/CodeSniffer.php#L1941 - - bin/phpcs --config-set installed_paths ../wordpress-coding-standards + - $PHPCS_DIR/bin/phpcs --config-set installed_paths $WPCS_DIR,$PHPCOMPAT_DIR # Hop into themes directory. - cd $theme_dir # After CodeSniffer install you should refresh your path. @@ -88,4 +92,4 @@ script: # -n flag: Do not print warnings (shortcut for --warning-severity=0) # --standard: Use WordPress as the standard. # --extensions: Only sniff PHP files. - - $WP_DEVELOP_DIR/php-codesniffer/bin/phpcs -p -s -v -n . --standard=./codesniffer.ruleset.xml --extensions=php --ignore=*/woocommerce/*,*/src/* + - $PHPCS_DIR/bin/phpcs -p -s -v -n . --extensions=php --ignore=*/woocommerce/*,*/src/*