| 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 | <rule ref="WordPress.NamingConventions.ValidVariableName"> |
|---|
| 9 | <properties> |
|---|
| 10 | <property name="customPropertiesWhitelist" type="array"> |
|---|
| 11 | <!-- From database structure queries --> |
|---|
| 12 | <element value="Collation"/> |
|---|
| 13 | <element value="Column_name"/> |
|---|
| 14 | <element value="Default"/> |
|---|
| 15 | <element value="Extra"/> |
|---|
| 16 | <element value="Field"/> |
|---|
| 17 | <element value="Index_type"/> |
|---|
| 18 | <element value="Key"/> |
|---|
| 19 | <element value="Key_name"/> |
|---|
| 20 | <element value="Msg_text"/> |
|---|
| 21 | <element value="Non_unique"/> |
|---|
| 22 | <element value="Null"/> |
|---|
| 23 | <element value="Sub_part"/> |
|---|
| 24 | <element value="Type"/> |
|---|
| 25 | <!-- From plugin/theme data --> |
|---|
| 26 | <element value="authorAndUri"/> |
|---|
| 27 | <element value="Name"/> |
|---|
| 28 | <element value="Version"/> |
|---|
| 29 | <!-- From the result of wp_xmlrpc_server::wp_getPageList() --> |
|---|
| 30 | <element value="dateCreated"/> |
|---|
| 31 | |
|---|
| 32 | <!-- From DOMDocument --> |
|---|
| 33 | <element value="childNodes"/> |
|---|
| 34 | <element value="formatOutput"/> |
|---|
| 35 | <element value="nodeName"/> |
|---|
| 36 | <element value="nodeType"/> |
|---|
| 37 | <element value="parentNode"/> |
|---|
| 38 | <element value="preserveWhiteSpace"/> |
|---|
| 39 | <element value="textContent"/> |
|---|
| 40 | <!-- From PHPMailer --> |
|---|
| 41 | <element value="AltBody"/> |
|---|
| 42 | <element value="Body"/> |
|---|
| 43 | <element value="CharSet"/> |
|---|
| 44 | <element value="ContentType"/> |
|---|
| 45 | <element value="Encoding"/> |
|---|
| 46 | <element value="Hostname"/> |
|---|
| 47 | <element value="mailHeader"/> |
|---|
| 48 | <element value="MIMEBody"/> |
|---|
| 49 | <element value="MIMEHeader"/> |
|---|
| 50 | <element value="Sender"/> |
|---|
| 51 | <element value="Subject"/> |
|---|
| 52 | <!-- From PHPUnit_Util_Getopt --> |
|---|
| 53 | <element value="longOptions"/> |
|---|
| 54 | <!-- From POP3 --> |
|---|
| 55 | <element value="ERROR"/> |
|---|
| 56 | <!-- From ZipArchive --> |
|---|
| 57 | <element value="numFiles"/> |
|---|
| 58 | </property> |
|---|
| 59 | </properties> |
|---|
| 60 | </rule> |
|---|
| 61 | |
|---|
| 62 | <arg name="extensions" value="php"/> |
|---|
| 63 | |
|---|
| 64 | <!-- Strip the filepaths down to the relevant bit. --> |
|---|
| 65 | <arg name="basepath" value="./"/> |
|---|
| 66 | |
|---|
| 67 | <!-- Check up to 20 files simultaneously. --> |
|---|
| 68 | <arg name="parallel" value="20"/> |
|---|
| 69 | |
|---|
| 70 | <!-- Show sniff codes in all reports --> |
|---|
| 71 | <arg value="ps"/> |
|---|
| 72 | |
|---|
| 73 | <file>.</file> |
|---|
| 74 | |
|---|
| 75 | <!-- Exclude the build folder in the current directory, as Travis puts the checkout in a build directory. --> |
|---|
| 76 | <exclude-pattern type="relative">^build/*</exclude-pattern> |
|---|
| 77 | |
|---|
| 78 | <!-- Directories and third party library exclusions --> |
|---|
| 79 | <exclude-pattern>/node_modules/*</exclude-pattern> |
|---|
| 80 | <exclude-pattern>/vendor/*</exclude-pattern> |
|---|
| 81 | |
|---|
| 82 | <exclude-pattern>/src/wp-admin/includes/class-ftp*</exclude-pattern> |
|---|
| 83 | <exclude-pattern>/src/wp-admin/includes/class-pclzip\.php</exclude-pattern> |
|---|
| 84 | <exclude-pattern>/src/wp-admin/includes/deprecated\.php</exclude-pattern> |
|---|
| 85 | <exclude-pattern>/src/wp-admin/includes/ms-deprecated\.php</exclude-pattern> |
|---|
| 86 | |
|---|
| 87 | <exclude-pattern>/src/wp-includes/atomlib\.php</exclude-pattern> |
|---|
| 88 | <exclude-pattern>/src/wp-includes/class-IXR\.php</exclude-pattern> |
|---|
| 89 | <exclude-pattern>/src/wp-includes/class-json\.php</exclude-pattern> |
|---|
| 90 | <exclude-pattern>/src/wp-includes/class-phpass\.php</exclude-pattern> |
|---|
| 91 | <exclude-pattern>/src/wp-includes/class-phpmailer\.php</exclude-pattern> |
|---|
| 92 | <exclude-pattern>/src/wp-includes/class-pop3\.php</exclude-pattern> |
|---|
| 93 | <exclude-pattern>/src/wp-includes/class-requests\.php</exclude-pattern> |
|---|
| 94 | <exclude-pattern>/src/wp-includes/class-simplepie\.php</exclude-pattern> |
|---|
| 95 | <exclude-pattern>/src/wp-includes/class-smtp\.php</exclude-pattern> |
|---|
| 96 | <exclude-pattern>/src/wp-includes/class-snoopy\.php</exclude-pattern> |
|---|
| 97 | <exclude-pattern>/src/wp-includes/class-wp-block-parser\.php</exclude-pattern> |
|---|
| 98 | <exclude-pattern>/src/wp-includes/deprecated\.php</exclude-pattern> |
|---|
| 99 | <exclude-pattern>/src/wp-includes/ms-deprecated\.php</exclude-pattern> |
|---|
| 100 | <exclude-pattern>/src/wp-includes/pluggable-deprecated\.php</exclude-pattern> |
|---|
| 101 | <exclude-pattern>/src/wp-includes/rss\.php</exclude-pattern> |
|---|
| 102 | |
|---|
| 103 | <exclude-pattern>/src/wp-includes/blocks/*</exclude-pattern> |
|---|
| 104 | <exclude-pattern>/src/wp-includes/ID3/*</exclude-pattern> |
|---|
| 105 | <exclude-pattern>/src/wp-includes/IXR/*</exclude-pattern> |
|---|
| 106 | <exclude-pattern>/src/wp-includes/random_compat/*</exclude-pattern> |
|---|
| 107 | <exclude-pattern>/src/wp-includes/Requests/*</exclude-pattern> |
|---|
| 108 | <exclude-pattern>/src/wp-includes/SimplePie/*</exclude-pattern> |
|---|
| 109 | <exclude-pattern>/src/wp-includes/Text/*</exclude-pattern> |
|---|
| 110 | |
|---|
| 111 | <exclude-pattern>/tests/phpunit/includes/speed-trap-listener\.php</exclude-pattern> |
|---|
| 112 | |
|---|
| 113 | <!-- Test data and fixtures --> |
|---|
| 114 | <exclude-pattern>/tests/phpunit/build*</exclude-pattern> |
|---|
| 115 | <exclude-pattern>/tests/phpunit/data/*</exclude-pattern> |
|---|
| 116 | |
|---|
| 117 | <exclude-pattern>/tools/*</exclude-pattern> |
|---|
| 118 | |
|---|
| 119 | <!-- Whitelist the WP DB Class and related tests for usage of direct database access functions. --> |
|---|
| 120 | <rule ref="WordPress.DB.RestrictedFunctions"> |
|---|
| 121 | <exclude-pattern>/src/wp-includes/wp-db\.php</exclude-pattern> |
|---|
| 122 | <exclude-pattern>/tests/phpunit/tests/db/charset\.php</exclude-pattern> |
|---|
| 123 | </rule> |
|---|
| 124 | |
|---|
| 125 | <!-- Whitelist the WP DB related tests for issues with prepared SQL placeholders |
|---|
| 126 | (as the handling of those are being tested). --> |
|---|
| 127 | <rule ref="WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare"> |
|---|
| 128 | <exclude-pattern>/tests/phpunit/tests/db\.php</exclude-pattern> |
|---|
| 129 | </rule> |
|---|
| 130 | <rule ref="WordPress.DB.PreparedSQLPlaceholders.UnsupportedPlaceholder"> |
|---|
| 131 | <exclude-pattern>/tests/phpunit/tests/db\.php</exclude-pattern> |
|---|
| 132 | </rule> |
|---|
| 133 | <rule ref="WordPress.DB.PreparedSQLPlaceholders.UnescapedLiteral"> |
|---|
| 134 | <exclude-pattern>/tests/phpunit/tests/db\.php</exclude-pattern> |
|---|
| 135 | </rule> |
|---|
| 136 | <rule ref="WordPress.DB.PreparedSQL.NotPrepared"> |
|---|
| 137 | <exclude-pattern>/tests/phpunit/tests/admin/includesSchema\.php</exclude-pattern> |
|---|
| 138 | <exclude-pattern>/tests/phpunit/tests/multisite/site\.php</exclude-pattern> |
|---|
| 139 | </rule> |
|---|
| 140 | |
|---|
| 141 | <!-- Whitelist the I18n functions file from issues identified by the I18n sniff |
|---|
| 142 | (such as calling the low-level translate() function). --> |
|---|
| 143 | <rule ref="WordPress.WP.I18n"> |
|---|
| 144 | <exclude-pattern>/src/wp-includes/l10n\.php</exclude-pattern> |
|---|
| 145 | <exclude-pattern>/tests/phpunit/tests/l10n\.php</exclude-pattern> |
|---|
| 146 | <exclude-pattern>/tests/phpunit/tests/l10n/loadTextdomainJustInTime\.php</exclude-pattern> |
|---|
| 147 | </rule> |
|---|
| 148 | |
|---|
| 149 | <rule ref="Generic.Functions.FunctionCallArgumentSpacing"> |
|---|
| 150 | <exclude-pattern>/wp-config\.php</exclude-pattern> |
|---|
| 151 | <exclude-pattern>/wp-config-sample\.php</exclude-pattern> |
|---|
| 152 | <exclude-pattern>/wp-tests-config\.php</exclude-pattern> |
|---|
| 153 | <exclude-pattern>/wp-tests-config-sample\.php</exclude-pattern> |
|---|
| 154 | </rule> |
|---|
| 155 | |
|---|
| 156 | <rule ref="Generic.Files.LineEndings"> |
|---|
| 157 | <exclude-pattern>/wp-config\.php</exclude-pattern> |
|---|
| 158 | <exclude-pattern>/wp-config-sample\.php</exclude-pattern> |
|---|
| 159 | </rule> |
|---|
| 160 | |
|---|
| 161 | <!-- WPCS1620: template.php isn't a template tag file. --> |
|---|
| 162 | <rule ref="WordPress.Files.FileName.InvalidTemplateTagFileName"> |
|---|
| 163 | <exclude-pattern>/src/wp-includes/template\.php</exclude-pattern> |
|---|
| 164 | </rule> |
|---|
| 165 | |
|---|
| 166 | <!-- WPCS1621: These files are expected to use _ instead of -. --> |
|---|
| 167 | <rule ref="WordPress.Files.FileName.NotHyphenatedLowercase"> |
|---|
| 168 | <exclude-pattern>/src/_index\.php</exclude-pattern> |
|---|
| 169 | <exclude-pattern>/src/wp-admin/_index\.php</exclude-pattern> |
|---|
| 170 | <exclude-pattern>/src/wp-content/themes/twentythirteen/taxonomy-post_format\.php</exclude-pattern> |
|---|
| 171 | <exclude-pattern>/src/wp-content/themes/twentyfourteen/taxonomy-post_format\.php</exclude-pattern> |
|---|
| 172 | </rule> |
|---|
| 173 | |
|---|
| 174 | <!-- Whitelist test classes for select sniffs. --> |
|---|
| 175 | <rule ref="WordPress.Files.FileName"> |
|---|
| 176 | <properties> |
|---|
| 177 | <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"/> |
|---|
| 178 | </properties> |
|---|
| 179 | </rule> |
|---|
| 180 | |
|---|
| 181 | <!-- Exclude the unit tests from select sniffs. --> |
|---|
| 182 | <rule ref="WordPress.Files.FileName.NotHyphenatedLowercase"> |
|---|
| 183 | <exclude-pattern>/tests/phpunit/tests/*</exclude-pattern> |
|---|
| 184 | </rule> |
|---|
| 185 | <rule ref="PEAR.NamingConventions.ValidClassName.Invalid"> |
|---|
| 186 | <exclude-pattern>/tests/phpunit/tests/*</exclude-pattern> |
|---|
| 187 | </rule> |
|---|
| 188 | |
|---|
| 189 | </ruleset> |
|---|