diff --git a/README.md b/README.md index 70c3471bb..f2b7d367c 100644 --- a/README.md +++ b/README.md @@ -218,7 +218,7 @@ The following files are also included unless the `--skip-tests` is used: * `bin/install-wp-tests.sh` configures the WordPress test suite and a test database. * `tests/bootstrap.php` is the file that makes the current plugin active when running the test suite. * `tests/test-sample.php` is a sample file containing test cases. -* `phpcs.xml.dist` is a collection of PHP_CodeSniffer rules. +* `.phpcs.xml.dist` is a collection of PHP_CodeSniffer rules. **OPTIONS** @@ -288,7 +288,7 @@ The following files are generated by default: * `bin/install-wp-tests.sh` configures the WordPress test suite and a test database. * `tests/bootstrap.php` is the file that makes the current plugin active when running the test suite. * `tests/test-sample.php` is a sample file containing the actual tests. -* `phpcs.xml.dist` is a collection of PHP_CodeSniffer rules. +* `.phpcs.xml.dist` is a collection of PHP_CodeSniffer rules. Learn more from the [plugin unit tests documentation](https://make.wordpress.org/cli/handbook/plugin-unit-tests/). @@ -426,7 +426,7 @@ The following files are generated by default: * `bin/install-wp-tests.sh` configures the WordPress test suite and a test database. * `tests/bootstrap.php` is the file that makes the current theme active when running the test suite. * `tests/test-sample.php` is a sample file containing the actual tests. -* `phpcs.xml.dist` is a collection of PHP_CodeSniffer rules. +* `.phpcs.xml.dist` is a collection of PHP_CodeSniffer rules. Learn more from the [plugin unit tests documentation](https://make.wordpress.org/cli/handbook/plugin-unit-tests/). diff --git a/features/scaffold-plugin-tests.feature b/features/scaffold-plugin-tests.feature index 158ea5d1f..e42358d1d 100644 --- a/features/scaffold-plugin-tests.feature +++ b/features/scaffold-plugin-tests.feature @@ -39,7 +39,7 @@ Feature: Scaffold plugin unit tests """ ./tests/test-sample.php """ - And the {PLUGIN_DIR}/hello-world/phpcs.xml.dist file should exist + And the {PLUGIN_DIR}/hello-world/.phpcs.xml.dist file should exist And the {PLUGIN_DIR}/hello-world/circle.yml file should not exist And the {PLUGIN_DIR}/hello-world/.circleci directory should not exist And the {PLUGIN_DIR}/hello-world/bitbucket-pipelines.yml file should not exist diff --git a/features/scaffold-theme-tests.feature b/features/scaffold-theme-tests.feature index 79250adcc..b6b61dc45 100644 --- a/features/scaffold-theme-tests.feature +++ b/features/scaffold-theme-tests.feature @@ -37,7 +37,7 @@ Feature: Scaffold theme unit tests """ ./tests/test-sample.php """ - And the {THEME_DIR}/p2child/phpcs.xml.dist file should exist + And the {THEME_DIR}/p2child/.phpcs.xml.dist file should exist And the {THEME_DIR}/p2child/circle.yml file should not exist And the {THEME_DIR}/p2child/.circleci directory should not exist And the {THEME_DIR}/p2child/bitbucket-pipelines.yml file should not exist diff --git a/features/scaffold.feature b/features/scaffold.feature index e56bbb67a..e270d34e8 100644 --- a/features/scaffold.feature +++ b/features/scaffold.feature @@ -224,9 +224,12 @@ Feature: WordPress code scaffolding .git .gitignore """ - And the {PLUGIN_DIR}/hello-world/phpcs.xml.dist file should contain: + And the {PLUGIN_DIR}/hello-world/.phpcs.xml.dist file should contain: + """ + + """ + And the {PLUGIN_DIR}/hello-world/.phpcs.xml.dist file should contain: """ - """ And the {PLUGIN_DIR}/hello-world/hello-world.php file should contain: diff --git a/src/Scaffold_Command.php b/src/Scaffold_Command.php index c85edf8a0..057575696 100644 --- a/src/Scaffold_Command.php +++ b/src/Scaffold_Command.php @@ -575,7 +575,7 @@ private function get_output_path( $assoc_args, $subdir ) { * * `bin/install-wp-tests.sh` configures the WordPress test suite and a test database. * * `tests/bootstrap.php` is the file that makes the current plugin active when running the test suite. * * `tests/test-sample.php` is a sample file containing test cases. - * * `phpcs.xml.dist` is a collection of PHP_CodeSniffer rules. + * * `.phpcs.xml.dist` is a collection of PHP_CodeSniffer rules. * * ## OPTIONS * @@ -706,7 +706,7 @@ function plugin( $args, $assoc_args ) { * * `bin/install-wp-tests.sh` configures the WordPress test suite and a test database. * * `tests/bootstrap.php` is the file that makes the current plugin active when running the test suite. * * `tests/test-sample.php` is a sample file containing the actual tests. - * * `phpcs.xml.dist` is a collection of PHP_CodeSniffer rules. + * * `.phpcs.xml.dist` is a collection of PHP_CodeSniffer rules. * * Learn more from the [plugin unit tests documentation](https://make.wordpress.org/cli/handbook/plugin-unit-tests/). * @@ -759,7 +759,7 @@ public function plugin_tests( $args, $assoc_args ) { * * `bin/install-wp-tests.sh` configures the WordPress test suite and a test database. * * `tests/bootstrap.php` is the file that makes the current theme active when running the test suite. * * `tests/test-sample.php` is a sample file containing the actual tests. - * * `phpcs.xml.dist` is a collection of PHP_CodeSniffer rules. + * * `.phpcs.xml.dist` is a collection of PHP_CodeSniffer rules. * * Learn more from the [plugin unit tests documentation](https://make.wordpress.org/cli/handbook/plugin-unit-tests/). * @@ -889,7 +889,7 @@ private function scaffold_plugin_theme_tests( $args, $assoc_args, $type ) { $to_copy = array( 'install-wp-tests.sh' => $bin_dir, 'phpunit.xml.dist' => $target_dir, - 'phpcs.xml.dist' => $target_dir, + '.phpcs.xml.dist' => $target_dir, ); foreach ( $to_copy as $file => $dir ) { diff --git a/templates/.phpcs.xml.dist b/templates/.phpcs.xml.dist new file mode 100644 index 000000000..50f02ba19 --- /dev/null +++ b/templates/.phpcs.xml.dist @@ -0,0 +1,48 @@ + + + Generally-applicable sniffs for WordPress plugins. + + + . + /vendor/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/templates/phpcs.xml.dist b/templates/phpcs.xml.dist deleted file mode 100644 index 7044659a0..000000000 --- a/templates/phpcs.xml.dist +++ /dev/null @@ -1,20 +0,0 @@ - - - Generally-applicable sniffs for WordPress plugins - - - - - - - - - - . - - - - - */node_modules/* - */vendor/* - diff --git a/templates/plugin-distignore.mustache b/templates/plugin-distignore.mustache index 6b7c70ebf..de45f50cb 100644 --- a/templates/plugin-distignore.mustache +++ b/templates/plugin-distignore.mustache @@ -20,7 +20,9 @@ phpunit.xml phpunit.xml.dist multisite.xml multisite.xml.dist +.phpcs.xml phpcs.xml +.phpcs.xml.dist phpcs.xml.dist README.md wp-cli.local.yml