forked from WordPress/gutenberg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpcs.xml.dist
188 lines (170 loc) · 7.52 KB
/
phpcs.xml.dist
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
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards for Gutenberg Plugin">
<description>Sniffs for WordPress plugins, with minor modifications for Gutenberg</description>
<!-- Check for cross-version support for PHP 7.0 and higher. -->
<config name="testVersion" value="7.0-"/>
<rule ref="PHPCompatibilityWP">
<include-pattern>*\.php$</include-pattern>
</rule>
<rule ref="WordPress-Core"/>
<rule ref="WordPress-Docs"/>
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array">
<element value="gutenberg"/>
<element value="default"/>
</property>
</properties>
</rule>
<rule ref="VariableAnalysis.CodeAnalysis.VariableAnalysis">
<properties>
<property name="allowUnusedParametersBeforeUsed" value="true"/>
</properties>
</rule>
<rule ref="PEAR.Functions.FunctionCallSignature">
<properties>
<property name="allowMultipleArguments" value="false"/>
</properties>
</rule>
<rule ref="WordPress.WP.I18n.MissingArgDomainDefault">
<exclude-pattern>lib/compat/*</exclude-pattern>
<exclude-pattern>packages/block-library/src/*</exclude-pattern>
<exclude-pattern>build/block-library/*</exclude-pattern>
</rule>
<arg value="ps"/>
<arg name="extensions" value="php"/>
<!-- Cache the scan results and re-use those for unchanged files on the next scan. -->
<arg name="cache" value=".cache/phpcs.json"/>
<file>./bin</file>
<file>./gutenberg.php</file>
<file>./lib</file>
<file>./packages</file>
<file>./phpunit</file>
<file>./post-content.php</file>
<!-- Exclude generated files -->
<exclude-pattern>./packages/block-serialization-spec-parser/parser.php</exclude-pattern>
<exclude-pattern>node_modules/*</exclude-pattern>
<exclude-pattern>build/*</exclude-pattern>
<!-- Exclude third party libraries -->
<exclude-pattern>./vendor/*</exclude-pattern>
<exclude-pattern>./test/php/gutenberg-coding-standards/*</exclude-pattern>
<!-- Exclude files maintained in WordPress Core and backported to Gutenberg -->
<exclude-pattern>./lib/compat/wordpress-*/html-api/*.php</exclude-pattern>
<!-- These special comments are markers for the build process -->
<rule ref="Squiz.Commenting.InlineComment.WrongStyle">
<exclude-pattern>gutenberg.php</exclude-pattern>
</rule>
<!-- Do not require docblocks for unit tests -->
<rule ref="Squiz.Commenting.FunctionComment.Missing">
<exclude-pattern>phpunit/*</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.FileComment.Missing">
<exclude-pattern>phpunit/*</exclude-pattern>
<exclude-pattern>test/gutenberg-test-themes/*</exclude-pattern>
<exclude-pattern>**/*.min.asset.php</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.ClassComment.Missing">
<exclude-pattern>phpunit/*</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.ClassComment.SpacingAfter">
<exclude-pattern>phpunit/*</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.MissingParamTag">
<exclude-pattern>phpunit/*</exclude-pattern>
</rule>
<rule ref="Generic.Commenting.DocComment.Empty">
<exclude-pattern>phpunit/*</exclude-pattern>
</rule>
<rule ref="Generic.Commenting.DocComment.MissingShort">
<exclude-pattern>phpunit/*</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.VariableComment.Missing">
<exclude-pattern>phpunit/*</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.FunctionCommentThrowTag.Missing">
<exclude-pattern>phpunit/*</exclude-pattern>
</rule>
<!-- Ignore filename error since it requires WP core build process change -->
<rule ref="WordPress.Files.FileName.InvalidClassFileName">
<exclude-pattern>/phpunit/*</exclude-pattern>
</rule>
<!-- Ignore empty files in tests/gutenberg-test-themes -->
<rule ref="Internal.NoCodeFound">
<exclude-pattern>./test/gutenberg-test-themes/*</exclude-pattern>
</rule>
<!-- Exclude PHPUnit tests from file and class name sniffs (for Core parity). -->
<rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
<exclude-pattern>/phpunit/*</exclude-pattern>
</rule>
<rule ref="PEAR.NamingConventions.ValidClassName.Invalid">
<exclude-pattern>/phpunit/*</exclude-pattern>
</rule>
<!-- Enforce checks against redeclaration for functions and classes. -->
<rule ref="Gutenberg.CodeAnalysis.GuardedFunctionAndClassNames">
<exclude-pattern>./phpunit/*</exclude-pattern>
<exclude-pattern>./packages/*</exclude-pattern>
<exclude-pattern>./bin/generate-gutenberg-php</exclude-pattern>
<properties>
<property name="functionsWhiteList" type="array">
<element value="/^_?gutenberg.+/"/>
</property>
<property name="classesWhiteList" type="array">
<element value="/^Gutenberg.+/"/>
</property>
</properties>
</rule>
<rule ref="Gutenberg.NamingConventions.ValidBlockLibraryFunctionName">
<include-pattern>./packages/block-library/src/*/*.php</include-pattern>
<properties>
<property name="prefixes" type="array">
<element value="block_core_"/>
<element value="render_block_core_"/>
<element value="register_block_core_"/>
</property>
<!--
The following list of functions is final and must not be extended.
It includes functions that cannot be renamed due to backward compatibility concerns.
-->
<property name="allowed_functions" type="array">
<element value="_delete_custom_logo_on_remove_site_logo"/>
<element value="_delete_site_logo_on_remove_custom_logo"/>
<element value="_delete_site_logo_on_remove_custom_logo_on_setup_theme"/>
<element value="_delete_site_logo_on_remove_theme_mods"/>
<element value="_override_custom_logo_theme_mod"/>
<element value="_sync_custom_logo_to_site_logo"/>
<element value="_wp_rest_api_autosave_meta"/>
<element value="_wp_rest_api_force_autosave_difference"/>
<element value="apply_block_core_search_border_style"/>
<element value="apply_block_core_search_border_styles"/>
<element value="build_dropdown_script_block_core_categories"/>
<element value="build_template_part_block_area_variations"/>
<element value="build_template_part_block_instance_variations"/>
<element value="build_template_part_block_variations"/>
<element value="build_variation_for_navigation_link"/>
<element value="classnames_for_block_core_search"/>
<element value="comments_block_form_defaults"/>
<element value="enqueue_legacy_post_comments_block_styles"/>
<element value="get_block_core_avatar_border_attributes"/>
<element value="get_block_core_post_featured_image_border_attributes"/>
<element value="get_block_core_post_featured_image_overlay_element_markup"/>
<element value="get_border_color_classes_for_block_core_search"/>
<element value="get_color_classes_for_block_core_search"/>
<element value="get_typography_classes_for_block_core_search"/>
<element value="get_typography_styles_for_block_core_search"/>
<element value="gutenberg_block_core_file_update_interactive_view_script"/>
<element value="gutenberg_block_core_navigation_update_interactive_view_script"/>
<element value="post_comments_form_block_form_defaults"/>
<element value="register_block_core_site_icon_setting"/>
<element value="register_legacy_post_comments_block"/>
<element value="styles_for_block_core_search"/>
<element value="wp_add_footnotes_revisions_to_post_meta"/>
<element value="wp_add_footnotes_to_revision"/>
<element value="wp_get_footnotes_from_revision"/>
<element value="wp_keep_footnotes_revision_id"/>
<element value="wp_latest_comments_draft_or_post_title"/>
<element value="wp_restore_footnotes_from_revision"/>
<element value="wp_save_footnotes_meta"/>
</property>
</properties>
</rule>
</ruleset>