Skip to content

Commit

Permalink
Run codesniffer only on pull requests
Browse files Browse the repository at this point in the history
  • Loading branch information
paul de wouters committed Feb 26, 2015
1 parent 7df7790 commit 69e581f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bin/phpcs.ruleset.xml
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards for Plugins">
<description>Generally-applicable sniffs for WordPress plugins</description>

<rule ref="WordPress-Extra" />

<exclude-pattern>/tests/*,/vendor/*</exclude-pattern>

</ruleset>
14 changes: 14 additions & 0 deletions bin/prepare.sh
@@ -0,0 +1,14 @@
#!/bin/bash

PLUGIN_DIR=$(pwd)
PHPCS_GITHUB_SRC=squizlabs/PHP_CodeSniffer
PHPCS_GIT_TREE=master
PHPCS_IGNORE="$TRAVIS_BUILD_DIR/tests,$TRAVIS_BUILD_DIR/vendor,$TRAVIS_BUILD_DIR/bin,$TRAVIS_BUILD_DIR/assets*,$TRAVIS_BUILD_DIR/languages,$TRAVIS_BUILD_DIR/node_modules,$TRAVIS_BUILD_DIR/readme"
echo "PHPCS_IGNORE: $PHPCS_IGNORE"
WPCS_DIR=/tmp/wpcs
WPCS_GITHUB_SRC=WordPress-Coding-Standards/WordPress-Coding-Standards
WPCS_GIT_TREE=develop

mkdir -p $PHPCS_DIR && curl -L https://github.com/$PHPCS_GITHUB_SRC/archive/$PHPCS_GIT_TREE.tar.gz | tar xvz --strip-components=1 -C $PHPCS_DIR
mkdir -p $WPCS_DIR && curl -L https://github.com/$WPCS_GITHUB_SRC/archive/$WPCS_GIT_TREE.tar.gz | tar xvz --strip-components=1 -C $WPCS_DIR
$PHPCS_DIR/scripts/phpcs --config-set installed_paths $WPCS_DIR

0 comments on commit 69e581f

Please sign in to comment.