Skip to content
Permalink
Browse files

Add base phpcs ruleset for plugins

  • Loading branch information...
westonruter committed Nov 7, 2013
1 parent 5de1b8e commit 9d1d0254c6bba84f84100bf9837d326ddb16032f
Showing with 28 additions and 1 deletion.
  1. +26 −0 phpcs.ruleset.xml
  2. +2 −1 readme.md
@@ -0,0 +1,26 @@
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards for Plugins">
<description>Generally-applicable sniffs for WordPress plugins</description>

<rule ref="WordPress">
<exclude name="WordPress.VIP.RestrictedFunctions"/>
<exclude name="WordPress.VIP.SuperGlobalInputUsage"/>
<exclude name="WordPress.VIP.ValidatedSanitizedInput"/>
</rule>
<rule ref="WordPress.NamingConventions.ValidFunctionName">
<exclude-pattern>/tests/*</exclude-pattern><!-- because of PHPUnit method names -->
</rule>

<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
<rule ref="Generic.Files.ByteOrderMark"/>
<rule ref="Generic.PHP.LowerCaseConstant"/>
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
<rule ref="Generic.PHP.NoSilencedErrors" />
<rule ref="Generic.Files.LineEndings">
<properties>
<property name="eolChar" value="\n"/>
</properties>
</rule>

</ruleset>
@@ -26,11 +26,12 @@ git subtree push --prefix bin \
git@github.com:x-team/wp-plugin-dev-lib.git master
```

Symlink to the `.travis.yml` and `.jshintrc` inside of the `bin/` directory you added:
Symlink to the `.travis.yml`, `.jshintrc`, and `phpcs.ruleset.xml` inside of the `bin/` directory you added:

```bash
ln -s bin/.travis.yml . && git add .travis.yml
ln -s bin/.jshintrc . && git add .jshintrc
ln -s bin/phpcs.ruleset.xml . && git add phpcs.ruleset.xml
```

Symlink to `pre-commit` from your project's `.git/hooks/pre-commit`:

1 comment on commit 9d1d025

@westonruter

This comment has been minimized.

Copy link
Collaborator Author

commented on 9d1d025 Nov 7, 2013

@x-team/wordpress-team as soon as the develop branch is merged into master for WordPress-Coding-Standards, we can update our plugins to symlink to the PHPCS ruleset XML.

/cc @shadyvb

Please sign in to comment.
You can’t perform that action at this time.