Skip to content

Commit c7a6bd3

Browse files
authored
Merge pull request #20 from stellarwp/feature/add-nexcess
Add just the Nexcess rules
2 parents 87efba5 + af865c6 commit c7a6bd3

File tree

2 files changed

+104
-3
lines changed

2 files changed

+104
-3
lines changed

MAD/ruleset.xml

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="MAD">
3+
<description>Coding standards for MAD packages.</description>
4+
5+
<!-- Enables parallel processing when available for faster results. -->
6+
<arg name="parallel" value="8"/>
7+
8+
<!-- Start with PSR-12 as a base. -->
9+
<rule ref="PSR12">
10+
<!--
11+
We don't have an easy way of reading the "testVersion" configuration value to selectively-
12+
apply this rule, but class constant visibility isn't available in PHP < 7.1 so we'll just
13+
exclude the rule for now.
14+
-->
15+
<exclude name="PSR12.Properties.ConstantVisibility.NotFound"/>
16+
</rule>
17+
18+
<!-- Import select WordPress rules. -->
19+
<rule ref="WordPress.PHP">
20+
<!-- Short-ternaries are fine. -->
21+
<exclude name="WordPress.PHP.DisallowShortTernary" />
22+
</rule>
23+
<rule ref="WordPress.Security"/>
24+
<rule ref="WordPress.WP">
25+
<!-- This rule has been deprecated, but will pop up sometimes. -->
26+
<exclude name="WordPress.WP.TimezoneChange" />
27+
</rule>
28+
29+
<!-- WordPress Documentation standards -->
30+
<rule ref="WordPress-Docs">
31+
<exclude name="Generic.Commenting.DocComment.MissingShort" />
32+
<exclude name="Squiz.Commenting.ClassComment.Missing" />
33+
<exclude name="Squiz.Commenting.FileComment.Missing" />
34+
<exclude name="Squiz.Commenting.FileComment.MissingPackageTag" />
35+
<exclude name="Squiz.Commenting.FileComment.MissingSubpackageTag" />
36+
<exclude name="Squiz.Commenting.FileComment.SpacingAfterOpen" />
37+
<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment" />
38+
<exclude name="Squiz.Commenting.FunctionComment.IncorrectTypeHint" />
39+
40+
<exclude-pattern>tests/*</exclude-pattern>
41+
</rule>
42+
43+
<!-- PHPCompatibilityWP -->
44+
<!-- https://github.com/PHPCompatibility/PHPCompatibilityWP -->
45+
<rule ref="PHPCompatibilityWP"/>
46+
47+
<!-- Disallow long array syntax. -->
48+
<rule ref="Generic.Arrays.DisallowLongArraySyntax" />
49+
50+
<!--
51+
Don't complain about missing elements in DocBlocks when {@inheritDoc} is used.
52+
53+
The inline `{@inheritDoc}` is only meant to be used for extending method descriptions, but the
54+
"inherit everything, including arguments + return values" alternative, `@inheritDoc` (no curly-
55+
braces) was never made official. As a result, many IDEs have chosen to interpret the inline
56+
version as full-inheritance.
57+
58+
In order to prevent PHP_CodeSniffer from assuming we forgot to write documentation that *should*
59+
be implicitly inherited, we're allowing `{@inheritDoc}`, even if it's not _technically_ correct.
60+
61+
Reference: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Customisable-Sniff-Properties#squizcommentingfunctioncomment
62+
Discussion: https://github.com/stellarwp/coding-standards/pull/3#discussion_r819890070
63+
-->
64+
<rule ref="Squiz.Commenting.FunctionComment">
65+
<properties>
66+
<property name="skipIfInheritdoc" value="true" />
67+
</properties>
68+
</rule>
69+
70+
<!--
71+
Special rules for tests:
72+
1. Test classes may use snake_case for method names (PSR1.Methods.CamelCapsMethodName.NotCamelCaps)
73+
2. Test classes can use whatever methods they'd like (WordPress.PHP.DiscouragedPHPFunctions, WordPress.PHP.DevelopmentFunctions)
74+
3. Test bootstrap files may both define symbols and have side-effects (PSR1.Files.SideEffects.FoundWithSymbols)
75+
-->
76+
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
77+
<exclude-pattern>tests/*</exclude-pattern>
78+
</rule>
79+
<rule ref="WordPress.PHP.DiscouragedPHPFunctions">
80+
<exclude-pattern>tests/*</exclude-pattern>
81+
</rule>
82+
<rule ref="WordPress.PHP.DevelopmentFunctions">
83+
<exclude-pattern>tests/*</exclude-pattern>
84+
</rule>
85+
<rule ref="PSR1.Files.SideEffects.FoundWithSymbols">
86+
<exclude-pattern>tests/bootstrap.php</exclude-pattern>
87+
</rule>
88+
89+
<!--
90+
Define the WordPress i18n text-domain.
91+
92+
Reference: https://github.com/WordPress/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#internationalization-setting-your-text-domain
93+
-->
94+
<rule ref="WordPress.WP.I18n">
95+
<properties>
96+
<property name="text_domain" type="array">
97+
<element value="stellarwp"/>
98+
</property>
99+
</properties>
100+
</rule>
101+
</ruleset>

composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
}
2020
],
2121
"require": {
22+
"automattic/vipwpcs": "^3.0",
2223
"php": ">=7.4",
23-
"squizlabs/php_codesniffer": "^3.8.0",
24-
"wp-coding-standards/wpcs": "^3.0.0",
2524
"slevomat/coding-standard": "^8.14.0",
26-
"automattic/vipwpcs": "^3.0"
25+
"squizlabs/php_codesniffer": "^3.8.0",
26+
"wp-coding-standards/wpcs": "^3.0.0"
2727
},
2828
"require-dev": {
2929
"dealerdirect/phpcodesniffer-composer-installer": "*",

0 commit comments

Comments
 (0)