Skip to content

Commit 5968235

Browse files
committed
feat: add WordPress ruleset
1 parent 8047c85 commit 5968235

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

GPA-Lab-WordPress/ruleset.xml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0"?>
2+
<ruleset
3+
name="GPA Lab WordPress"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd"
6+
>
7+
8+
<description>
9+
A modified version of the WordPress PHP coding standard.
10+
</description>
11+
12+
<arg name="colors"/>
13+
<arg name="extensions" value="php" />
14+
<arg value="s"/>
15+
16+
<!-- Identify PHP cross-version compatibility issues in projects based on the WordPress CMS -->
17+
<rule ref="PHPCompatibilityWP" />
18+
19+
<!-- Include the three WordPress coding standards rulesets. -->
20+
<rule ref="WordPress-Core" />
21+
<rule ref="WordPress-Docs" />
22+
<rule ref="WordPress-Extra" />
23+
24+
<!-- Exclude unwanted rules from the Wordpress ruleset. -->
25+
<rule ref="WordPress">
26+
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent" />
27+
<exclude name="WordPress.Arrays.ArrayIndentation.ItemNotAligned" />
28+
<exclude name="WordPress.Arrays.ArrayIndentation.MultiLineArrayItemNotAligned" />
29+
<exclude name="WordPress.WhiteSpace.PrecisionAlignment" />
30+
</rule>
31+
32+
<!-- Override indent settings to default to two spaces. -->
33+
<rule ref="Generic.WhiteSpace.ScopeIndent">
34+
<properties>
35+
<property name="indent" value="2"/>
36+
<property name="tabIndent" value="false"/>
37+
</properties>
38+
</rule>
39+
40+
<rule ref="PEAR.Functions.FunctionCallSignature">
41+
<properties>
42+
<property name="requiredSpacesAfterOpen" value="1"/>
43+
<property name="requiredSpacesBeforeClose" value="1"/>
44+
<property name="indent" value="2"/>
45+
<property name="allowMultipleArguments" value="false"/>
46+
</properties>
47+
</rule>
48+
49+
</ruleset>

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,10 @@
1111
"php": "^7.2 || ^8.0",
1212
"squizlabs/php_codesniffer": "^3.6.2",
1313
"phpcsstandards/phpcsextra": "^1.0"
14+
},
15+
"suggest": {
16+
"phpcompatibility/php-compatibility": "Required when using the GPA-Lab-WordPress standard",
17+
"phpcompatibility/phpcompatibility-wp": "Required when using the GPA-Lab-WordPress standard",
18+
"wp-coding-standards/wpcs": "Required when using the GPA-Lab-WordPress standard"
1419
}
1520
}

0 commit comments

Comments
 (0)