From 7ebf180c6ad393f47c6eb864b12981b2bb48c92c Mon Sep 17 00:00:00 2001 From: sagarnasit Date: Wed, 22 May 2019 17:40:06 +0530 Subject: [PATCH 1/2] PHPCS: Add new ruleset in the project --- .gitignore | 3 ++ composer.json | 2 +- dist-archive-command.php | 6 +-- phpcs.xml.dist | 95 +++++++++++++++++++--------------------- 4 files changed, 51 insertions(+), 55 deletions(-) diff --git a/.gitignore b/.gitignore index 6711a81..0346fa9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ composer.lock node_modules/ vendor/ *.log +phpunit.xml +phpcs.xml +.phpcs.xml diff --git a/composer.json b/composer.json index 2d116a0..c8d60c3 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ }, "require-dev": { "behat/behat": "~2.5", - "wp-cli/wp-cli-tests": "^2", + "wp-cli/wp-cli-tests": "^2.1", "wp-cli/scaffold-command": "^2", "wp-cli/extension-command": "^2" }, diff --git a/dist-archive-command.php b/dist-archive-command.php index b7df159..9fa9731 100644 --- a/dist-archive-command.php +++ b/dist-archive-command.php @@ -4,9 +4,9 @@ return; } -$autoload = dirname( __FILE__ ) . '/vendor/autoload.php'; -if ( file_exists( $autoload ) ) { - require_once $autoload; +$wpcli_dist_archive_autoloader = dirname( __FILE__ ) . '/vendor/autoload.php'; +if ( file_exists( $wpcli_dist_archive_autoloader ) ) { + require_once $wpcli_dist_archive_autoloader; } WP_CLI::add_command( 'dist-archive', 'Dist_Archive_Command' ); diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 1663286..1c02193 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -1,61 +1,54 @@ - - Custom ruleset for WP-CLI + + Custom ruleset for WP-CLI dist-archive-command + + + + + . - - + + - - . - - */.git/* - */ci/* - */features/* - */packages/* - */tests/* - */utils/* - */vendor/* - - - - - - - - - - - - - - + + - - + + - - - */php/commands/src/CLI_Command.php - + - - - - - - - + + + - - + + + + + - + + + + - - + + From d892e5fb3cfd721036c83379dd0c26921a9e789a Mon Sep 17 00:00:00 2001 From: sagarnasit Date: Wed, 22 May 2019 18:11:41 +0530 Subject: [PATCH 2/2] PHPCS: Fix phpcs errors --- phpcs.xml.dist | 1 + src/Dist_Archive_Command.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 1c02193..e3ffbdd 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -43,6 +43,7 @@ + diff --git a/src/Dist_Archive_Command.php b/src/Dist_Archive_Command.php index 8523288..b0d3f09 100644 --- a/src/Dist_Archive_Command.php +++ b/src/Dist_Archive_Command.php @@ -145,7 +145,8 @@ function( $ignored_file ) { $ignored_file = substr( $ignored_file, 0, ( strlen( $ignored_file ) - 2 ) ); } return "--exclude='{$ignored_file}'"; - }, $ignored_files + }, + $ignored_files ); $excludes = implode( ' ', $excludes ); $cmd = "tar {$excludes} -zcvf {$archive_file} {$archive_base}";