-
Notifications
You must be signed in to change notification settings - Fork 2
/
phpcs.xml
195 lines (138 loc) · 7.92 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<?xml version="1.0"?>
<!-- https://github.com/WordPress/WordPress-Coding-Standards -->
<!-- https://github.com/WPTRT/WPThemeReview -->
<!-- wpcs3.0での変更点: https://github.com/WordPress/WordPress-Coding-Standards/wiki/Upgrade-Guide-to-WordPressCS-3.0.0-for-ruleset-maintainers -->
<!-- PHPCSStandards, PHPCompatibility 解説 -->
<!-- https://github.com/PHPCSStandards/PHPCSExtra -->
<!-- https://github.com/PHPCSStandards/PHPCSUtils -->
<!-- https://github.com/PHPCompatibility/PHPCompatibilityWP -->
<ruleset name="WordPress Theme Coding Standards">
<!-- Set a description for this ruleset. -->
<description>A custom set of code standard rules to check for WordPress.</description>
<!--
#############################################################################
COMMAND LINE ARGUMENTS
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
#############################################################################
-->
<!-- composer install で installed_paths をセットしてくれるっぽいが、念の為 -->
<config name="installed_paths" value="vendor/phpcsstandards/phpcsutils,vendor/phpcompatibility/php-compatibility,vendor/phpcompatibility/phpcompatibility-paragonie,vendor/phpcompatibility/phpcompatibility-wp,vendor/phpcsstandards/phpcsextra,vendor/wp-coding-standards/wpcs"/>
<!-- Pass some flags to PHPCS:
p flag: Show progress of the run.
s flag: Show sniff codes in all reports.
-->
<arg value="ps"/>
<!-- Strip the filepaths down to the relevant bit. -->
<arg name="basepath" value="./"/>
<!-- Check up to 8 files simultanously. -->
<arg name="parallel" value="8"/>
<!-- Only check the PHP files. JS, and CSS files are checked separately with @wordpress/scripts package. -->
<arg name="extensions" value="php"/>
<!-- Check all files in this directory and the directories below it. -->
<file>.</file>
<!-- Exclude patterns. -->
<exclude-pattern>/vendor/*</exclude-pattern>
<exclude-pattern>/node_modules/*</exclude-pattern>
<!-- <exclude-pattern>/_test.php</exclude-pattern> -->
<!--
#############################################################################
USE THE WordPress AND THE Theme Review RULESET
#############################################################################
-->
<!-- array()禁止して []を使う こと -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax.Found"/>
<rule ref="WordPress">
<!-- This rule does not apply here since the _s prefix should be changed by the theme author. -->
<exclude name="WordPress.NamingConventions.PrefixAllGlobals.ShortPrefixPassed"/>
<!-- ファイルコメントに関するルールを除外 -->
<exclude name="Squiz.Commenting" />
<exclude name="Generic.Commenting" />
<!-- コードをコメントアウトした時の警告を除去 -->
<exclude name="Squiz.PHP.CommentedOutCode.Found" />
<!-- ifなどは1行で書いてはいけないルールを除外 -->
<exclude name="Generic.ControlStructures.InlineControlStructure.NotAllowed" />
<!-- クラスのファイル名を "class-" 出始めないといけないルールを除外 -->
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
<!-- オブジェクトプロパティの snake_case ルールを除外 ( ->$Version などに影響) -->
<exclude name="WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase" />
<!-- 変数の snake_case ルールを除外 ( $SETTING などに影響) -->
<exclude name="WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase" />
<exclude name="WordPress.NamingConventions.ValidVariableName.InterpolatedVariableNotSnakeCase" />
<!-- 関数の snake_case ルールを除外 -->
<exclude name="WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid" />
<!-- ファイル名を_から始めた時に出るエラーを除外 -->
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
<!-- インデント -->
<exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact" />
<exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect" />
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed" />
<!-- 三項演算子 ?: を許可 -->
<exclude name="Universal.Operators.DisallowShortTernary" />
<!-- "translation:" コメントがなくても許す -->
<exclude name="WordPress.WP.I18n.MissingTranslatorsComment" />
<!-- $_REQUEST などにエラー出さない -->
<exclude name="WordPress.Security.ValidatedSanitizedInput.InputNotSanitized" />
<exclude name="WordPress.Security.ValidatedSanitizedInput.MissingUnslash" />
<!-- PHP省略タグを許可 -->
<exclude name="Generic.PHP.DisallowShortOpenTag.EchoFound" />
<!-- array() の強制を解除 -->
<exclude name="Universal.Arrays.DisallowShortArraySyntax" />
<!-- 配列 [] の端スペースが必須であるルールを解除 -->
<!-- <exclude name="NormalizedArrays.Arrays.ArrayBraceSpacing" /> -->
<!-- 無名関数 のフックが改行されないように -->
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket" />
<exclude name="PEAR.Functions.FunctionCallSignature.MultipleArguments" />
<exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine" />
<!-- urlencodeに警告出さない -->
<exclude name="WordPress.PHP.DiscouragedPHPFunctions.urlencode_urlencode" />
<!-- file_get_contents に警告出さない -->
<exclude name="WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents" />
<!-- json_encode に警告出さない -->
<exclude name="WordPress.WP.AlternativeFunctions.json_encode_json_encode" />
<!-- NONCEチェック -->
<exclude name="WordPress.Security.NonceVerification.Missing" />
<!-- meta queryへの警告を停止 -->
<exclude name="WordPress.DB.SlowDBQuery.slow_db_query_meta_key" />
<!-- $wpdbの警告を停止 -->
<exclude name="WordPress.DB.DirectDatabaseQuery.NoCaching" />
<exclude name="WordPress.DB.DirectDatabaseQuery.DirectQuery" />
<exclude name="WordPress.DB.PreparedSQL.InterpolatedNotPrepared" />
<exclude name="WordPress.DB.PreparedSQL.NotPrepared" />
<!-- Yoda記法以外への警告を停止 -->
<exclude name="WordPress.PHP.YodaConditions.NotYoda" />
<!-- Taxクエリ許可 -->
<exclude name="WordPress.DB.SlowDBQuery.slow_db_query_tax_query" />
<!-- $_POSTなどの取得にnonce必須の警告を停止 -->
<exclude name="WordPress.Security.NonceVerification.Recommended" />
<!-- theme/plugin prefix 必須の警告を停止 -->
<exclude name="WordPress.NamingConventions.PrefixAllGlobals" />
<!-- file_put_contentsを許可 -->
<exclude name="WordPress.WP.AlternativeFunctions.file_system_read_file_put_contents" />
<!-- function と () の間のスペース強要を解除 -->
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.SpaceAfterFunction" />
<!-- 名前空間の先頭の \を許可 -->
<exclude name="Universal.UseStatements.NoLeadingBackslash.LeadingBackslashFound" />
<!-- <?=?>での簡易組み込みする時、スペースの強要を解除 -->
<exclude name="Squiz.PHP.EmbeddedPhp" />
<!-- ?? 演算子を許可-->
<exclude name="PHPCompatibility.Operators.NewOperators.t_coalesceFound" />
<!-- 無名関数を許可 -->
<!-- <exclude name="PHPCompatibility.FunctionDeclarations.NewClosure.Found" /> -->
<!-- namespace を許可 -->
<!-- <exclude name="PHPCompatibility.Keywords.NewKeywords.t_namespaceFound" /> -->
</rule>
<!-- Theme -->
<!-- <rule ref="WPThemeReview"/> -->
<!--
#############################################################################
SNIFF SPECIFIC CONFIGURATION
#############################################################################
-->
<!-- Verify that the text_domain is set to the desired text-domain.
(Multiple valid text domains can be provided as a comma-delimited list.) -->
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array" value="seo-simple-pack"/>
</properties>
</rule>
</ruleset>