Skip to content

Commit adee071

Browse files
Copilotswissspidy
andcommitted
Add phpcs.xml.dist to scaffolded packages
Co-authored-by: swissspidy <[email protected]>
1 parent 391b22c commit adee071

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

features/scaffold-package.feature

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ Feature: Scaffold WP-CLI commands
1818
"""
1919
.gitignore
2020
"""
21+
And the {PACKAGE_PATH}/local/wp-cli/foo/phpcs.xml.dist file should exist
22+
And the {PACKAGE_PATH}/local/wp-cli/foo/phpcs.xml.dist file should contain:
23+
"""
24+
WP_CLI_CS
25+
"""
2126
And the {PACKAGE_PATH}/local/wp-cli/foo/composer.json file should exist
2227
And the {PACKAGE_PATH}/local/wp-cli/foo/composer.json file should contain:
2328
"""
@@ -127,6 +132,7 @@ Feature: Scaffold WP-CLI commands
127132
"""
128133
And the custom-directory/.gitignore file should exist
129134
And the custom-directory/.editorconfig file should exist
135+
And the custom-directory/phpcs.xml.dist file should exist
130136
And the custom-directory/composer.json file should exist
131137
And the custom-directory/hello-world-command.php file should exist
132138
And the custom-directory/wp-cli.yml file should exist
@@ -195,6 +201,7 @@ Feature: Scaffold WP-CLI commands
195201
"""
196202
And the {PACKAGE_PATH}/local/wp-cli/with-tests/.gitignore file should exist
197203
And the {PACKAGE_PATH}/local/wp-cli/with-tests/.editorconfig file should exist
204+
And the {PACKAGE_PATH}/local/wp-cli/with-tests/phpcs.xml.dist file should exist
198205
And the {PACKAGE_PATH}/local/wp-cli/with-tests/composer.json file should exist
199206
And the {PACKAGE_PATH}/local/wp-cli/with-tests/hello-world-command.php file should exist
200207
And the {PACKAGE_PATH}/local/wp-cli/with-tests/wp-cli.yml file should exist
@@ -260,5 +267,6 @@ Feature: Scaffold WP-CLI commands
260267
Installing package
261268
"""
262269
And the {PACKAGE_PATH}/local/wp-cli/foo/.gitignore file should exist
270+
And the {PACKAGE_PATH}/local/wp-cli/foo/phpcs.xml.dist file should exist
263271
And the {PACKAGE_PATH}/local/wp-cli/foo/.github/PULL_REQUEST_TEMPLATE file should not exist
264272
And the {PACKAGE_PATH}/local/wp-cli/foo/.github/ISSUE_TEMPLATE file should not exist

src/ScaffoldPackageCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ScaffoldPackageCommand {
1616
* Default behavior is to create the following files:
1717
* - command.php
1818
* - composer.json (with package name, description, and license)
19-
* - .gitignore, .editorconfig, and .distignore
19+
* - .gitignore, .editorconfig, .distignore, and phpcs.xml.dist
2020
* - README.md (via wp scaffold package-readme)
2121
* - Test harness (via wp scaffold package-tests)
2222
*
@@ -118,6 +118,7 @@ public function package( $args, $assoc_args ) {
118118
"{$package_dir}/.gitignore" => file_get_contents( "{$package_root}/.gitignore" ),
119119
"{$package_dir}/.editorconfig" => file_get_contents( "{$package_root}/.editorconfig" ),
120120
"{$package_dir}/.distignore" => file_get_contents( "{$package_root}/.distignore" ),
121+
"{$package_dir}/phpcs.xml.dist" => file_get_contents( "{$package_root}/phpcs.xml.dist" ),
121122
"{$package_dir}/CONTRIBUTING.md" => file_get_contents( "{$package_root}/CONTRIBUTING.md" ),
122123
"{$package_dir}/wp-cli.yml" => $wp_cli_yml,
123124
"{$package_dir}/hello-world-command.php" => Utils\mustache_render( "{$template_path}/hello-world-command.mustache", $assoc_args ),

0 commit comments

Comments
 (0)