-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathruleset.xml
More file actions
101 lines (84 loc) · 4.05 KB
/
ruleset.xml
File metadata and controls
101 lines (84 loc) · 4.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?xml version="1.0"?>
<ruleset
name="WPGraphQL Minimum Coding Standard"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpcodesniffer.com/phpcs.xsd"
>
<description>WPGraphQL Minimum Coding Standard</description>
<!-- The rules below are the changes from between the original sniff or parent ruleset, and what
should be applied for this Standard. -->
<rule ref="PHPCompatibilityWP">
<include-pattern>*\.php$</include-pattern>
</rule>
<!--
Load WordPress VIP Go standards
We do this first, since we don't trust them to disable rules that we want to use.
@see: https://docs.wpvip.com/technical-references/vip-code-analysis-bot/phpcs-report/
-->
<rule ref="WordPress-VIP-Go">
<!-- Deprecated: @todo remove in PHPCS 4.0 -->
<exclude name="WordPressVIPMinimum.JS" />
</rule>
<!--
The main WPCS
@see: https://github.com/WordPress/WordPress-Coding-Standard
-->
<rule ref="WordPress">
<!-- Definitely should not be added back -->
<exclude name="Universal.Arrays.DisallowShortArraySyntax" />
<exclude name="Universal.Operators.DisallowShortTernary.Found" />
<exclude name="WordPress.Files.FileName" />
<exclude name="WordPress.NamingConventions.ValidVariableName" />
<!-- Should probably not be added back -->
<exclude name="WordPress.NamingConventions.ValidHookName.UseUnderscores" />
<!-- Added back in WPGraphQL-Strict -->
<exclude name="Generic.CodeAnalysis.UnusedFunctionParameter" />
<exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine" />
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket" />
<exclude name="PEAR.Functions.FunctionCallSignature.MultipleArguments" />
<exclude name="WordPress.WP.Capabilities.Undetermined" />
<exclude name="WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid" />
</rule>
<!-- Tests for inline documentation of code -->
<rule ref="WordPress-Docs">
<exclude name="Generic.Commenting.DocComment.MissingShort" />
<!-- Added back in WPGraphQL-Docs -->
<exclude name="Squiz.Commenting" />
</rule>
<!-- Enforce short array syntax -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax" />
<!--
Slevomat sniffs
See: https://github.com/slevomat/coding-standard/tree/master#alphabetical-list-of-sniffs
-->
<rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility" />
<rule ref="SlevomatCodingStandard.Classes.DisallowConstructorPropertyPromotion" />
<rule ref="SlevomatCodingStandard.Classes.DisallowLateStaticBindingForConstants" />
<rule ref="SlevomatCodingStandard.Classes.DisallowMultiConstantDefinition" />
<rule ref="SlevomatCodingStandard.Classes.DisallowMultiPropertyDefinition" />
<rule ref="SlevomatCodingStandard.Classes.DisallowStringExpressionPropertyFetch" />
<rule ref="SlevomatCodingStandard.Classes.RequireSelfReference" />
<rule ref="SlevomatCodingStandard.Classes.UselessLateStaticBinding" />
<rule ref="SlevomatCodingStandard.ControlStructures.UselessTernaryOperator" />
<rule ref="SlevomatCodingStandard.Functions.StaticClosure" />
<rule ref="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure" />
<rule ref="SlevomatCodingStandard.Functions.UselessParameterDefaultValue" />
<rule ref="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation">
<properties>
<property name="ignoredAnnotationNames" type="array">
<element value="@phpstan-import-type" />
<element value="@phpstan-param" />
<element value="@phpstan-return" />
<element value="@phpstan-template" />
<element value="@phpstan-type" />
<element value="@phpstan-var" />
</property>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash" />
<rule ref="SlevomatCodingStandard.PHP.OptimizedFunctionsWithoutUnpacking" />
<rule ref="SlevomatCodingStandard.PHP.TypeCast" />
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.LessSpecificNativeTypeHint" />
<rule ref="SlevomatCodingStandard.Variables.DuplicateAssignmentToVariable" />
<rule ref="SlevomatCodingStandard.Variables.UselessVariable" />
</ruleset>