From 0d353e1c0c996b5534d6c72bce2ee84bdfe05360 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 12 Jun 2017 00:11:53 +0200 Subject: [PATCH 1/2] Rename the PHPCS ruleset. If the file is called `phpcs.xml` or `phpcs.xml.dist`, it is automatically picked up by PHPCS. A `phpcs.xml` is given preference over a `phpcs.xml.dist` file. So renaming the file to `phpcs.xml.dist` allows for people to use the file provided by `_s` if they choose not to add their own, but also leaves people the freedom to easily overrule it. --- .travis.yml | 5 +++-- codesniffer.ruleset.xml => phpcs.xml.dist | 0 2 files changed, 3 insertions(+), 2 deletions(-) rename codesniffer.ruleset.xml => phpcs.xml.dist (100%) diff --git a/.travis.yml b/.travis.yml index 91b7ffc2..c23feb07 100644 --- a/.travis.yml +++ b/.travis.yml @@ -83,9 +83,10 @@ script: # -s flag: Show sniff codes in all reports. # -v flag: Print verbose output. # -n flag: Do not print warnings. (shortcut for --warning-severity=0) - # --standard: Use WordPress as the standard. + # Uses a custom ruleset based on WordPress. This ruleset is automatically + # picked up by PHPCS as it's named `phpcs.xml(.dist)`. # --extensions: Only sniff PHP files. - - if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/scripts/phpcs -p -s -v -n . --standard=./codesniffer.ruleset.xml --extensions=php; fi + - if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/scripts/phpcs -p -s -v -n . --extensions=php; fi # Receive notifications for build results. # @link http://docs.travis-ci.com/user/notifications/#Email-notifications diff --git a/codesniffer.ruleset.xml b/phpcs.xml.dist similarity index 100% rename from codesniffer.ruleset.xml rename to phpcs.xml.dist From b78d0537728d9d1cd693a4826c1229c8fec7d8f0 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 12 Jun 2017 00:21:34 +0200 Subject: [PATCH 2/2] PHPCS: Move the recommended command line arguments into the custom ruleset. --- .travis.yml | 7 +------ phpcs.xml.dist | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index c23feb07..03201ffc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -79,14 +79,9 @@ script: # WordPress Coding Standards. # @link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards # @link http://pear.php.net/package/PHP_CodeSniffer/ - # -p flag: Show progress of the run. - # -s flag: Show sniff codes in all reports. - # -v flag: Print verbose output. - # -n flag: Do not print warnings. (shortcut for --warning-severity=0) # Uses a custom ruleset based on WordPress. This ruleset is automatically # picked up by PHPCS as it's named `phpcs.xml(.dist)`. - # --extensions: Only sniff PHP files. - - if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/scripts/phpcs -p -s -v -n . --extensions=php; fi + - if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/scripts/phpcs; fi # Receive notifications for build results. # @link http://docs.travis-ci.com/user/notifications/#Email-notifications diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 2d06727b..6bf620da 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -6,6 +6,20 @@ A custom set of code standard rules to check for WordPress themes. + + + + + + + + . +