forked from postlight/headless-wp-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpcs.xml
98 lines (88 loc) · 4.77 KB
/
phpcs.xml
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
<?xml version="1.0"?>
<ruleset name="Postlight PHPCS Config">
<!--
See also:
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage
-->
<description>Postlight PHP coding standards configuration.</description>
<!-- Command line args, compare to: /vendor/bin/phpcs -(v)s -extensions=php -colors -->
<arg value="s"/> <!-- Show sniffs report. -->
<arg name="colors"/> <!-- Use colors in reports. -->
<arg name="extensions" value="php,dist" /> <!-- Sniff these file types. -->
<!--
============================================================================
PSR-2 ruleset:
https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/PSR2/ruleset.xml
-->
<rule ref="PSR2">
<exclude name="PSR2.Methods.FunctionCallSignature.SpaceAfterOpenBracket" />
<exclude name="PSR2.Methods.FunctionCallSignature.SpaceBeforeCloseBracket" />
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterOpen" />
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingBeforeClose" />
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine" />
<exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine" />
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" />
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />
<exclude name="Squiz.ControlStructures.ForLoopDeclaration.SpacingAfterOpen" />
<exclude name="Squiz.ControlStructures.ForLoopDeclaration.SpacingBeforeClose" />
<exclude name="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen" />
<exclude name="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceBeforeClose" />
<exclude name="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma" />
<exclude name="Squiz.Strings.ConcatenationSpacing.PaddingFound" />
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceBeforeEquals" />
<exclude name="PSR2.Namespaces.UseDeclaration.MultipleDeclarations" />
<exclude name="Squiz.PHP.DisallowMultipleAssignments" />
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" />
</rule>
<rule ref="PSR2.ControlStructures.ControlStructureSpacing">
<properties>
<property name="requiredSpacesAfterOpen" value="1" />
<property name="requiredSpacesBeforeClose" value="1" />
</properties>
</rule>
<!--
============================================================================
WordPress rulesets:
WordPress-Extra: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/develop/WordPress-Extra/ruleset.xml
WordPress-VIP: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/develop/WordPress-VIP/ruleset.xml
https://vip.wordpress.com/documentation/code-review-what-we-look-for
-->
<rule ref="WordPress-Extra">
<!-- Allow spaces -->
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed" />
<exclude name="WordPress.VIP.SuperGlobalInputUsage.AccessDetected" />
<exclude name="WordPress.WhiteSpace.OperatorSpacing" />
</rule>
<rule ref="WordPress-VIP" />
<!--
============================================================================
Documentation rulesets:
WordPress-Docs: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/develop/WordPress-Docs/ruleset.xml
https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/
Generic Commenting: https://github.com/squizlabs/PHP_CodeSniffer/tree/master/src/Standards/Generic/Sniffs/Commenting
-->
<rule ref="WordPress-Docs">
<!-- Do not enforce having a file comment for each file. -->
<exclude name="Squiz.Commenting.FileComment" />
<!-- Don't require full stop in comments. -->
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop" />
<!-- Don't require comment capitalization. -->
<exclude name="Generic.Commenting.DocComment.LongNotCapital" />
</rule>
<rule ref="Generic.Commenting">
<exclude name="Generic.Commenting.DocComment.MissingShort" />
<exclude name="Generic.Commenting.Fixme" />
<exclude name="Generic.Commenting.Todo" />
</rule>
<!--
============================================================================
Special or one-off rules.
-->
<!-- Normalize all require/require_onces to use statement, not function, syntax. -->
<rule ref="PEAR.Files.IncludingFile.BracketsNotRequired" />
<!-- Require short array syntax -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
</ruleset>