Skip to content

Commit 495d5cc

Browse files
committed
init commit
1 parent 723dfbd commit 495d5cc

File tree

4 files changed

+83
-2
lines changed

4 files changed

+83
-2
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
composer.phar
2+
composer.lock
23
/vendor/
34

45
# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
56
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
67
# composer.lock
8+
.buildpath
9+
.project
10+
.settings/

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
1-
# php
2-
Style guide for writing consistent PHP for WordPress projects.
1+
# Inpsyde PHP Coding Standards for PHP_CodeSniffer
2+
PHP coding standards for writing consistent PHP for WordPress projects.
3+
4+
## Installation
5+
Standards can be installed with [Composer](https://getcomposer.org/) dependency manager:
6+
7+
```
8+
$ composer require inpsyde/php-coding-standards
9+
```
10+

composer.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "inpsyde/php-coding-standards",
3+
"description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions",
4+
"keywords": [
5+
"phpcs",
6+
"standards",
7+
"WordPress"
8+
],
9+
"license": "MIT",
10+
"require": {
11+
"squizlabs/php_codesniffer": "^2.9.0",
12+
"wp-coding-standards/wpcs": "~0.6.0"
13+
}
14+
}

ruleset.xml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Inpsyde Coding Standards Configuration">
3+
<!-- See https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
4+
5+
<!-- Set a description for this ruleset. -->
6+
<description>A custom set of code standard rules to check for Inpsyde Codex.</description>
7+
8+
<exclude-pattern>vendor/*</exclude-pattern>
9+
<exclude-pattern>node_modules/*</exclude-pattern>
10+
<exclude-pattern>*.min.js</exclude-pattern>
11+
12+
<!-- TRUE, FALSE, NULL are constant, we write in uppercase. -->
13+
<rule ref="Generic.PHP.UpperCaseConstant"/>
14+
15+
<!-- Allow . in hook names -->
16+
<rule ref="WordPress.NamingConventions.ValidHookName">
17+
<properties>
18+
<property name="additionalWordDelimiters" value="."/>
19+
</properties>
20+
</rule>
21+
22+
<!-- Include the WordPress ruleset, with exclusions. -->
23+
<rule ref="WordPress">
24+
<!-- Yoda conditions are not helpful, cost only time. -->
25+
<exclude name="WordPress.PHP.YodaConditions"/>
26+
27+
<exclude name="Generic.PHP.LowerCaseConstant"/>
28+
<exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect"/>
29+
<exclude name="Generic.Commenting.DocComment.MissingShort"/>
30+
31+
<exclude name="PEAR.Functions.FunctionCallSignature"/>
32+
33+
<!-- Remove spaces before types check. -->
34+
<exclude name="Squiz.Commenting.VariableComment.VarIndent"/>
35+
<exclude name="Squiz.Commenting.FunctionComment.SpacingBeforeParamType"/>
36+
<exclude name="Squiz.Commenting.FunctionComment.SpacingBeforeParams"/>
37+
38+
<!-- Exclude Full Stops on inline comment. -->
39+
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar"/>
40+
<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment"/>
41+
42+
<!-- Remove empty line not required before block comment -->
43+
<exclude name="Squiz.Commenting.BlockComment.HasEmptyLineBefore"/>
44+
<!-- Remove rule for /** style for each var -->
45+
<exclude name="Squiz.Commenting.VariableComment.WrongStyle"/>
46+
47+
<exclude name="WordPress.WhiteSpace.ScopeIndent.Incorrect"/>
48+
<exclude name="WordPress.Arrays.ArrayKeySpacingRestrictions"/>
49+
<exclude name="WordPress.Arrays.ArrayDeclaration.KeyNotAligned"/>
50+
51+
<!-- Remove spaces instead of tabs check -->
52+
<exclude name="WordPress.Arrays.ArrayDeclaration.ValueNotAligned"/>
53+
<exclude name="WordPress.Arrays.ArrayDeclaration.CloseBraceNotAligned"/>
54+
</rule>
55+
</ruleset>

0 commit comments

Comments
 (0)