-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathphpcs.xml
130 lines (110 loc) · 5.43 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards for Plugins">
<description>Generally-applicable sniffs for WordPress plugins</description>
<!--
#############################################################################
COMMAND LINE ARGUMENTS
https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Annotated-Ruleset
#############################################################################
-->
<file>.</file>
<!-- Only check PHP files. -->
<arg name="extensions" value="php"/>
<!-- Show progress, show the error codes for each message (source). -->
<arg value="ps"/>
<!-- Strip the filepaths down to the relevant bit. 加入這行就會失效了 -->
<!-- <arg name="basepath" value="."/> -->
<!-- Check up to 8 files simultaneously. -->
<arg name="parallel" value="8"/>
<rule ref="WordPress-Core">
<exclude name="Squiz.Commenting.FileComment.MissingPackageTag"/>
<exclude name="WordPress.PHP.DevelopmentFunctions.error_log_print_r"/>
</rule>
<rule ref="WordPress-Docs">
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<rule ref="WordPress-Extra"/>
<rule ref="WordPress">
<exclude name="WordPress.Files.FileName"/>
<exclude name="WordPress.PHP.YodaConditions.NotYoda"/>
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
<exclude name="WordPress.Security.EscapeOutput.OutputNotEscaped"/>
<exclude name="PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket"/>
<exclude name="PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket"/>
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterOpenParenthesis"/>
<exclude name="WordPress.WhiteSpace.OperatorSpacing.NoSpaceBefore"/>
<exclude name="WordPress.WhiteSpace.OperatorSpacing.NoSpaceAfter"/>
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeCloseParenthesis"/>
<exclude name="WordPress.DateTime.RestrictedFunctions.date_date"/>
<exclude name="Generic.Commenting.DocComment.MissingShort"/>
<exclude name="Universal.Operators.DisallowShortTernary.Found"/>
<exclude name="PEAR.Functions.FunctionCallSignature.Indent"/>
<exclude name="Squiz.Commenting.FunctionComment.ThrowsNoFullStop"/>
<exclude name="Universal.Classes.RequireFinalClass.NonFinalClassFound"/>
<exclude name="Squiz.Commenting.FunctionComment.MissingParamName"/>
<exclude name="Squiz.Commenting.FunctionComment.MissingParamTag"/>
<exclude name="WordPress.PHP.NoSilencedErrors.Discouraged"/>
<exclude name="WordPress.WP.I18n.MissingTranslatorsComment"/>
<exclude name="Squiz.Commenting.FileComment.Missing"/>
<exclude name="WordPress.Security.EscapeOutput.ExceptionNotEscaped"/>
</rule>
<exclude-pattern>.idea/*</exclude-pattern>
<exclude-pattern>js/*</exclude-pattern>
<exclude-pattern>./release/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="4"/>
<property name="exact" value="true"/>
<property name="tabIndent" value="true"/>
</properties>
</rule>
<config name="testVersion" value="8.0-"/>
<rule ref="PHPCompatibility"/>
<!-- Enforce PSR1 compatible namespaces. -->
<rule ref="PSR1.Classes.ClassDeclaration"/>
<!-- Enforce that classes are abstract or final. -->
<rule ref="Universal.Classes.RequireFinalClass">
<!-- ... with the exception of four sniffs which are known to be extended by external standards. -->
<exclude-pattern>/WordPress/Sniffs/NamingConventions/ValidHookNameSniff\.php$</exclude-pattern>
<exclude-pattern>
/WordPress/Sniffs/Security/(EscapeOutput|NonceVerification|ValidatedSanitizedInput)Sniff\.php$
</exclude-pattern>
</rule>
<!-- Enforce that methods in traits are always final. -->
<rule ref="Universal.FunctionDeclarations.RequireFinalMethodsInTraits"/>
<!--
#############################################################################
SNIFF SPECIFIC CONFIGURATION
#############################################################################
-->
<rule ref="WordPress.Arrays.MultipleStatementAlignment">
<properties>
<property name="alignMultilineItems" value="!=100"/>
<property name="exact" value="true" phpcs-only="true"/>
</properties>
</rule>
<!-- exclude Full-Stop comment style -->
<rule ref="Squiz.Commenting.FunctionComment">
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop"/>
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar"/>
</rule>
<!-- Allow short syntax arrays. -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<rule ref="Universal.Arrays.DisallowShortArraySyntax.Found">
<severity>0</severity>
</rule>
<!-- Disallow long array syntax -->
<rule ref="Generic.Arrays.DisallowShortArraySyntax.Found">
<exclude-pattern>*</exclude-pattern>
</rule>
<rule ref="Generic.Files.LineEndings">
<exclude name="Generic.Files.LineEndings.InvalidEOLChar"/>
</rule>
<!-- 允許單行 <?php. -->
<rule ref="Squiz.PHP.EmbeddedPhp.ContentAfterOpen">
<severity>0</severity>
</rule>
</ruleset>