Make WordPress Core

Ticket #41057: phpcs.xml.9.dist

File phpcs.xml.9.dist, 4.5 KB (added by pento, 7 years ago)
Line 
1<?xml version="1.0"?>
2<ruleset name="WordPress Coding Standards">
3        <description>Apply WordPress Coding Standards to all Core files</description>
4
5        <rule ref="WordPress-Core"/>
6        <rule ref="WordPress.CodeAnalysis.EmptyStatement"/>
7
8        <arg name="extensions" value="php"/>
9
10        <!-- Show sniff codes in all reports -->
11        <arg value="ps"/>
12
13        <file>.</file>
14
15        <!-- Directories and third party library exclusions -->
16        <exclude-pattern>/build/*</exclude-pattern>
17        <exclude-pattern>/node_modules/*</exclude-pattern>
18        <exclude-pattern>/vendor/*</exclude-pattern>
19
20        <exclude-pattern>/src/wp-admin/includes/class-ftp*</exclude-pattern>
21        <exclude-pattern>/src/wp-admin/includes/class-pclzip\.php</exclude-pattern>
22        <exclude-pattern>/src/wp-admin/includes/deprecated\.php</exclude-pattern>
23        <exclude-pattern>/src/wp-admin/includes/ms-deprecated\.php</exclude-pattern>
24
25        <exclude-pattern>/src/wp-includes/atomlib\.php</exclude-pattern>
26        <exclude-pattern>/src/wp-includes/class-IXR\.php</exclude-pattern>
27        <exclude-pattern>/src/wp-includes/class-json\.php</exclude-pattern>
28        <exclude-pattern>/src/wp-includes/class-phpass\.php</exclude-pattern>
29        <exclude-pattern>/src/wp-includes/class-phpmailer\.php</exclude-pattern>
30        <exclude-pattern>/src/wp-includes/class-pop3\.php</exclude-pattern>
31        <exclude-pattern>/src/wp-includes/class-requests\.php</exclude-pattern>
32        <exclude-pattern>/src/wp-includes/class-simplepie\.php</exclude-pattern>
33        <exclude-pattern>/src/wp-includes/class-smtp\.php</exclude-pattern>
34        <exclude-pattern>/src/wp-includes/class-snoopy\.php</exclude-pattern>
35        <exclude-pattern>/src/wp-includes/deprecated\.php</exclude-pattern>
36        <exclude-pattern>/src/wp-includes/ms-deprecated\.php</exclude-pattern>
37        <exclude-pattern>/src/wp-includes/pluggable-deprecated\.php</exclude-pattern>
38        <exclude-pattern>/src/wp-includes/rss\.php</exclude-pattern>
39
40        <exclude-pattern>/src/wp-includes/ID3/*</exclude-pattern>
41        <exclude-pattern>/src/wp-includes/IXR/*</exclude-pattern>
42        <exclude-pattern>/src/wp-includes/random_compat/*</exclude-pattern>
43        <exclude-pattern>/src/wp-includes/Requests/*</exclude-pattern>
44        <exclude-pattern>/src/wp-includes/SimplePie/*</exclude-pattern>
45        <exclude-pattern>/src/wp-includes/Text/*</exclude-pattern>
46
47        <!-- Test data and fixtures -->
48        <exclude-pattern>/tests/phpunit/build*</exclude-pattern>
49        <exclude-pattern>/tests/phpunit/data/*</exclude-pattern>
50
51        <!-- Whitelist the WP DB Class and related tests for usage of direct database access functions. -->
52        <rule ref="WordPress.DB.RestrictedFunctions">
53                <exclude-pattern>/src/wp-includes/wp-db\.php</exclude-pattern>
54                <exclude-pattern>/tests/phpunit/tests/db/charset\.php</exclude-pattern>
55        </rule>
56
57        <!-- Whitelist the WP DB related tests for issues with prepared SQL placeholders
58                 (as the handling of those are being tested). -->
59        <rule ref="WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare">
60                <exclude-pattern>/tests/phpunit/tests/db\.php</exclude-pattern>
61        </rule>
62        <rule ref="WordPress.DB.PreparedSQLPlaceholders.UnsupportedPlaceholder">
63                <exclude-pattern>/tests/phpunit/tests/db\.php</exclude-pattern>
64        </rule>
65        <rule ref="WordPress.DB.PreparedSQLPlaceholders.UnescapedLiteral">
66                <exclude-pattern>/tests/phpunit/tests/db\.php</exclude-pattern>
67        </rule>
68
69        <rule ref="Generic.Functions.FunctionCallArgumentSpacing">
70                <exclude-pattern>/wp-config\.php</exclude-pattern>
71                <exclude-pattern>/wp-config-sample\.php</exclude-pattern>
72                <exclude-pattern>/wp-tests-config\.php</exclude-pattern>
73                <exclude-pattern>/wp-tests-config-sample\.php</exclude-pattern>
74        </rule>
75
76        <!-- Whitelist test classes for select sniffs. -->
77        <rule ref="WordPress.Files.FileName">
78                <properties>
79                        <property name="custom_test_class_whitelist" type="array" value="WP_UnitTestCase,WP_Ajax_UnitTestCase,WP_Canonical_UnitTestCase,WP_Test_REST_TestCase,WP_Test_REST_Controller_Testcase,WP_Test_REST_Post_Type_Controller_Testcase,WP_XMLRPC_UnitTestCase"/>
80                </properties>
81        </rule>
82        <rule ref="WordPress.Variables.GlobalVariables">
83                <properties>
84                        <property name="custom_test_class_whitelist" type="array" value="WP_UnitTestCase,WP_Ajax_UnitTestCase,WP_Canonical_UnitTestCase,WP_Test_REST_TestCase,WP_Test_REST_Controller_Testcase,WP_Test_REST_Post_Type_Controller_Testcase,WP_XMLRPC_UnitTestCase"/>
85                </properties>
86        </rule>
87
88        <!-- Exclude the unit tests from select sniffs. -->
89        <rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
90                <exclude-pattern>/tests/phpunit/tests/*</exclude-pattern>
91        </rule>
92        <rule ref="PEAR.NamingConventions.ValidClassName.Invalid">
93                <exclude-pattern>/tests/phpunit/tests/*</exclude-pattern>
94        </rule>
95
96</ruleset>