Make WordPress Core

Ticket #41057: phpcs8.xml.dist

File phpcs8.xml.dist, 4.4 KB (added by jrf, 7 years ago)

Further iteration on the ruleset with more fine-grained exclude patterns for select sniffs

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        <!--
6        phpcbf -.-standard=phpcs8.xml.dist -.-report-summary -.-report-source -.-report-full=./20170926-11-phpcbf-all-incl-new-sniffs.txt -.-basepath=I:/000_GitHub/WP_test_suite/
7        -->
8
9        <rule ref="WordPress-Core"/>
10        <rule ref="WordPress.CodeAnalysis.EmptyStatement"/>
11
12        <arg name="extensions" value="php"/>
13
14        <!-- Show sniff codes in all reports -->
15        <arg value="ps"/>
16
17        <file>.</file>
18
19        <!-- Directories and third party library exclusions -->
20        <exclude-pattern>/build/*</exclude-pattern>
21        <exclude-pattern>/node_modules/*</exclude-pattern>
22
23        <exclude-pattern>/src/wp-admin/includes/class-ftp*</exclude-pattern>
24        <exclude-pattern>/src/wp-admin/includes/class-pclzip\.php</exclude-pattern>
25        <exclude-pattern>/src/wp-admin/includes/deprecated\.php</exclude-pattern>
26        <exclude-pattern>/src/wp-admin/includes/ms-deprecated\.php</exclude-pattern>
27
28        <exclude-pattern>/src/wp-includes/atomlib\.php</exclude-pattern>
29        <exclude-pattern>/src/wp-includes/class-IXR\.php</exclude-pattern>
30        <exclude-pattern>/src/wp-includes/class-json\.php</exclude-pattern>
31        <exclude-pattern>/src/wp-includes/class-phpass\.php</exclude-pattern>
32        <exclude-pattern>/src/wp-includes/class-phpmailer\.php</exclude-pattern>
33        <exclude-pattern>/src/wp-includes/class-pop3\.php</exclude-pattern>
34        <exclude-pattern>/src/wp-includes/class-requests\.php</exclude-pattern>
35        <exclude-pattern>/src/wp-includes/class-simplepie\.php</exclude-pattern>
36        <exclude-pattern>/src/wp-includes/class-smtp\.php</exclude-pattern>
37        <exclude-pattern>/src/wp-includes/class-snoopy\.php</exclude-pattern>
38        <exclude-pattern>/src/wp-includes/deprecated\.php</exclude-pattern>
39        <exclude-pattern>/src/wp-includes/ms-deprecated\.php</exclude-pattern>
40        <exclude-pattern>/src/wp-includes/pluggable-deprecated\.php</exclude-pattern>
41        <exclude-pattern>/src/wp-includes/rss\.php</exclude-pattern>
42
43        <exclude-pattern>/src/wp-includes/ID3/*</exclude-pattern>
44        <exclude-pattern>/src/wp-includes/IXR/*</exclude-pattern>
45        <exclude-pattern>/src/wp-includes/random_compat/*</exclude-pattern>
46        <exclude-pattern>/src/wp-includes/Requests/*</exclude-pattern>
47        <exclude-pattern>/src/wp-includes/SimplePie/*</exclude-pattern>
48        <exclude-pattern>/src/wp-includes/Text/*</exclude-pattern>
49
50        <exclude-pattern>/tests/phpunit/build*</exclude-pattern>
51        <exclude-pattern>/tests/phpunit/data/plugins/wordpress-importer*</exclude-pattern>
52        <exclude-pattern>/tests/phpunit/data/\.trac-ticket-cache*</exclude-pattern>
53       
54        <!-- Whitelist the WP DB Class and related tests for usage of direct database access functions. -->
55        <rule ref="WordPress.DB.RestrictedFunctions">
56                <exclude-pattern>/src/wp-includes/wp-db\.php</exclude-pattern>
57                <exclude-pattern>/tests/phpunit/tests/db/charset\.php</exclude-pattern>
58        </rule>
59
60        <!-- Whitelist the WP DB related tests for issues with prepared SQL placeholders
61                 (as the handling of those are being tested). -->
62        <rule ref="WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare">
63                <exclude-pattern>/tests/phpunit/tests/db\.php</exclude-pattern>
64        </rule>
65        <rule ref="WordPress.DB.PreparedSQLPlaceholders.UnsupportedPlaceholder">
66                <exclude-pattern>/tests/phpunit/tests/db\.php</exclude-pattern>
67        </rule>
68        <rule ref="WordPress.DB.PreparedSQLPlaceholders.UnescapedLiteral">
69                <exclude-pattern>/tests/phpunit/tests/db\.php</exclude-pattern>
70        </rule>
71
72        <!-- Whitelist test classes for select sniffs. -->
73        <rule ref="WordPress.Files.FileName">
74                <properties>
75                        <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"/>
76                </properties>
77        </rule>
78        <rule ref="WordPress.Variables.GlobalVariables">
79                <properties>
80                        <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"/>
81                </properties>
82        </rule>
83
84        <!-- Exclude the unit tests from select sniffs. -->
85        <rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
86                <exclude-pattern>/tests/phpunit/tests/*</exclude-pattern>
87        </rule>
88        <rule ref="PEAR.NamingConventions.ValidClassName.Invalid">
89                <exclude-pattern>/tests/phpunit/tests/*</exclude-pattern>
90        </rule>
91
92</ruleset>