Skip to content

Commit fd3a648

Browse files
authored
Merge pull request #19 from xwp/update/phpcs
Use phpcs.xml.dist instead of custom-named phpcs.ruleset.xml
2 parents 8015b66 + a5bb586 commit fd3a648

File tree

9 files changed

+26
-18
lines changed

9 files changed

+26
-18
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ The following files are also included unless the `--skip-tests` is used:
152152
* `bin/install-wp-tests.sh` configures the WordPress test suite and a test database.
153153
* `tests/bootstrap.php` is the file that makes the current plugin active when running the test suite.
154154
* `tests/test-sample.php` is a sample file containing test cases.
155-
* `phpcs.ruleset.xml` is a collenction of PHP_CodeSniffer rules.
155+
* `phpcs.xml.dist` is a collection of PHP_CodeSniffer rules.
156156

157157
**OPTIONS**
158158

@@ -222,7 +222,7 @@ The following files are generated by default:
222222
* `bin/install-wp-tests.sh` configures the WordPress test suite and a test database.
223223
* `tests/bootstrap.php` is the file that makes the current plugin active when running the test suite.
224224
* `tests/test-sample.php` is a sample file containing the actual tests.
225-
* `phpcs.ruleset.xml` is a collenction of PHP_CodeSniffer rules.
225+
* `phpcs.xml.dist` is a collection of PHP_CodeSniffer rules.
226226

227227
Learn more from the [plugin unit tests documentation](http://wp-cli.org/docs/plugin-unit-tests/).
228228

@@ -360,7 +360,7 @@ The following files are generated by default:
360360
* `bin/install-wp-tests.sh` configures the WordPress test suite and a test database.
361361
* `tests/bootstrap.php` is the file that makes the current theme active when running the test suite.
362362
* `tests/test-sample.php` is a sample file containing the actual tests.
363-
* `phpcs.ruleset.xml` is a collenction of PHP_CodeSniffer rules.
363+
* `phpcs.xml.dist` is a collection of PHP_CodeSniffer rules.
364364

365365
Learn more from the [plugin unit tests documentation](http://wp-cli.org/docs/plugin-unit-tests/).
366366

features/scaffold-plugin-tests.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Feature: Scaffold plugin unit tests
3636
install-wp-tests.sh
3737
"""
3838
And the {PLUGIN_DIR}/hello-world/phpunit.xml.dist file should exist
39-
And the {PLUGIN_DIR}/hello-world/phpcs.ruleset.xml file should exist
39+
And the {PLUGIN_DIR}/hello-world/phpcs.xml.dist file should exist
4040
And the {PLUGIN_DIR}/hello-world/circle.yml file should not exist
4141
And the {PLUGIN_DIR}/hello-world/.gitlab-ci.yml file should not exist
4242
And the {PLUGIN_DIR}/hello-world/.travis.yml file should contain:
@@ -49,7 +49,7 @@ Feature: Scaffold plugin unit tests
4949
fi
5050
- |
5151
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
52-
phpcs --standard=phpcs.ruleset.xml $(find . -name '*.php')
52+
phpcs
5353
fi
5454
"""
5555
And the {PLUGIN_DIR}/hello-world/.travis.yml file should contain:

features/scaffold-theme-tests.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Feature: Scaffold theme unit tests
3333
install-wp-tests.sh
3434
"""
3535
And the {THEME_DIR}/p2child/phpunit.xml.dist file should exist
36-
And the {THEME_DIR}/p2child/phpcs.ruleset.xml file should exist
36+
And the {THEME_DIR}/p2child/phpcs.xml.dist file should exist
3737
And the {THEME_DIR}/p2child/circle.yml file should not exist
3838
And the {THEME_DIR}/p2child/.gitlab-ci.yml file should not exist
3939
And the {THEME_DIR}/p2child/.travis.yml file should contain:
@@ -46,7 +46,7 @@ Feature: Scaffold theme unit tests
4646
fi
4747
- |
4848
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
49-
phpcs --standard=phpcs.ruleset.xml $(find . -name '*.php')
49+
phpcs
5050
fi
5151
"""
5252
And the {THEME_DIR}/p2child/.travis.yml file should contain:

src/Scaffold_Command.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ private function get_output_path( $assoc_args, $subdir ) {
453453
* * `bin/install-wp-tests.sh` configures the WordPress test suite and a test database.
454454
* * `tests/bootstrap.php` is the file that makes the current plugin active when running the test suite.
455455
* * `tests/test-sample.php` is a sample file containing test cases.
456-
* * `phpcs.ruleset.xml` is a collenction of PHP_CodeSniffer rules.
456+
* * `phpcs.xml.dist` is a collection of PHP_CodeSniffer rules.
457457
*
458458
* ## OPTIONS
459459
*
@@ -584,7 +584,7 @@ function plugin( $args, $assoc_args ) {
584584
* * `bin/install-wp-tests.sh` configures the WordPress test suite and a test database.
585585
* * `tests/bootstrap.php` is the file that makes the current plugin active when running the test suite.
586586
* * `tests/test-sample.php` is a sample file containing the actual tests.
587-
* * `phpcs.ruleset.xml` is a collenction of PHP_CodeSniffer rules.
587+
* * `phpcs.xml.dist` is a collection of PHP_CodeSniffer rules.
588588
*
589589
* Learn more from the [plugin unit tests documentation](http://wp-cli.org/docs/plugin-unit-tests/).
590590
*
@@ -636,7 +636,7 @@ public function plugin_tests( $args, $assoc_args ) {
636636
* * `bin/install-wp-tests.sh` configures the WordPress test suite and a test database.
637637
* * `tests/bootstrap.php` is the file that makes the current theme active when running the test suite.
638638
* * `tests/test-sample.php` is a sample file containing the actual tests.
639-
* * `phpcs.ruleset.xml` is a collenction of PHP_CodeSniffer rules.
639+
* * `phpcs.xml.dist` is a collection of PHP_CodeSniffer rules.
640640
*
641641
* Learn more from the [plugin unit tests documentation](http://wp-cli.org/docs/plugin-unit-tests/).
642642
*
@@ -762,7 +762,7 @@ private function scaffold_plugin_theme_tests( $args, $assoc_args, $type ) {
762762
$to_copy = array(
763763
'install-wp-tests.sh' => $bin_dir,
764764
'phpunit.xml.dist' => $target_dir,
765-
'phpcs.ruleset.xml' => $target_dir,
765+
'phpcs.xml.dist' => $target_dir,
766766
);
767767

768768
foreach ( $to_copy as $file => $dir ) {

templates/phpcs.ruleset.xml renamed to templates/phpcs.xml.dist

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
<rule ref="WordPress-Core" />
66
<rule ref="WordPress-Docs" />
77

8+
<!-- Check all PHP files in directory tree by default. -->
9+
<arg name="extensions" value="php"/>
10+
<file>.</file>
11+
12+
<!-- Show sniff codes in all reports -->
13+
<arg value="s"/>
14+
815
<exclude-pattern>*/node_modules/*</exclude-pattern>
916
<exclude-pattern>*/vendor/*</exclude-pattern>
1017
</ruleset>

templates/plugin-circle.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ test:
1717
composer global require wp-coding-standards/wpcs
1818
phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs
1919
override:
20-
- phpcs --standard=phpcs.ruleset.xml $(find . -name '*.php')
20+
- phpcs
2121
{{#wp_versions_to_test}}
2222
- |
2323
rm -rf $WP_TESTS_DIR $WP_CORE_DIR

templates/plugin-distignore.mustache

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ phpunit.xml
1818
phpunit.xml.dist
1919
multisite.xml
2020
multisite.xml.dist
21-
phpcs.ruleset.xml
21+
phpcs.xml
22+
phpcs.xml.dist
2223
README.md
2324
wp-cli.local.yml
2425
tests

templates/plugin-gitlab.mustache

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ PHPunit:PHP5.3:MySQL:
2929
services:
3030
- mysql:5.6
3131
script:
32-
- phpcs --standard=phpcs.ruleset.xml $(find . -name '*.php')
33-
- phpunit --configuration phpunit.xml.dist
32+
- phpcs
33+
- phpunit
3434

3535
PHPunit:PHP5.6:MySQL:
3636
image: tetraweb/php:5.6
3737
services:
3838
- mysql:5.6
3939
script:
40-
- phpcs --standard=phpcs.ruleset.xml $(find . -name '*.php')
41-
- phpunit --configuration phpunit.xml.dist
40+
- phpcs
41+
- phpunit

templates/plugin-travis.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,5 @@ script:
5656
fi
5757
- |
5858
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
59-
phpcs --standard=phpcs.ruleset.xml $(find . -name '*.php')
59+
phpcs
6060
fi

0 commit comments

Comments
 (0)