2017-12-01 04:40:04 +01:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
<ruleset name="WordPress Coding Standards">
|
|
|
|
<description>Apply WordPress Coding Standards to all Core files</description>
|
|
|
|
|
|
|
|
<rule ref="WordPress-Core"/>
|
|
|
|
<rule ref="WordPress.CodeAnalysis.EmptyStatement"/>
|
|
|
|
|
2019-01-12 07:05:55 +01:00
|
|
|
<rule ref="WordPress.NamingConventions.ValidVariableName">
|
|
|
|
<properties>
|
|
|
|
<property name="customPropertiesWhitelist" type="array">
|
|
|
|
<!-- From database structure queries -->
|
|
|
|
<element value="Collation"/>
|
|
|
|
<element value="Column_name"/>
|
|
|
|
<element value="Default"/>
|
|
|
|
<element value="Extra"/>
|
|
|
|
<element value="Field"/>
|
|
|
|
<element value="Index_type"/>
|
|
|
|
<element value="Key"/>
|
|
|
|
<element value="Key_name"/>
|
|
|
|
<element value="Msg_text"/>
|
|
|
|
<element value="Non_unique"/>
|
|
|
|
<element value="Null"/>
|
|
|
|
<element value="Sub_part"/>
|
|
|
|
<element value="Type"/>
|
|
|
|
<!-- From plugin/theme data -->
|
|
|
|
<element value="authorAndUri"/>
|
|
|
|
<element value="Name"/>
|
|
|
|
<element value="Version"/>
|
|
|
|
<!-- From the result of wp_xmlrpc_server::wp_getPageList() -->
|
|
|
|
<element value="dateCreated"/>
|
|
|
|
|
|
|
|
<!-- From DOMDocument -->
|
|
|
|
<element value="childNodes"/>
|
|
|
|
<element value="formatOutput"/>
|
|
|
|
<element value="nodeName"/>
|
|
|
|
<element value="nodeType"/>
|
|
|
|
<element value="parentNode"/>
|
|
|
|
<element value="preserveWhiteSpace"/>
|
|
|
|
<element value="textContent"/>
|
|
|
|
<!-- From PHPMailer -->
|
|
|
|
<element value="AltBody"/>
|
|
|
|
<element value="Body"/>
|
|
|
|
<element value="CharSet"/>
|
|
|
|
<element value="ContentType"/>
|
|
|
|
<element value="Encoding"/>
|
|
|
|
<element value="Hostname"/>
|
|
|
|
<element value="mailHeader"/>
|
|
|
|
<element value="MIMEBody"/>
|
|
|
|
<element value="MIMEHeader"/>
|
|
|
|
<element value="Sender"/>
|
|
|
|
<element value="Subject"/>
|
|
|
|
<!-- From PHPUnit_Util_Getopt -->
|
|
|
|
<element value="longOptions"/>
|
|
|
|
<!-- From POP3 -->
|
|
|
|
<element value="ERROR"/>
|
|
|
|
<!-- From ZipArchive -->
|
|
|
|
<element value="numFiles"/>
|
|
|
|
</property>
|
|
|
|
</properties>
|
|
|
|
</rule>
|
|
|
|
|
2017-12-01 04:40:04 +01:00
|
|
|
<arg name="extensions" value="php"/>
|
|
|
|
|
2018-06-15 17:56:58 +02:00
|
|
|
<!-- Strip the filepaths down to the relevant bit. -->
|
|
|
|
<arg name="basepath" value="./"/>
|
|
|
|
|
2019-01-09 11:01:32 +01:00
|
|
|
<!-- Check up to 20 files simultaneously. -->
|
2018-06-15 17:56:58 +02:00
|
|
|
<arg name="parallel" value="20"/>
|
|
|
|
|
2017-12-01 04:40:04 +01:00
|
|
|
<!-- Show sniff codes in all reports -->
|
|
|
|
<arg value="ps"/>
|
|
|
|
|
|
|
|
<file>.</file>
|
|
|
|
|
2018-08-17 03:50:26 +02:00
|
|
|
<!-- Exclude the build folder in the current directory, as Travis puts the checkout in a build directory. -->
|
|
|
|
<exclude-pattern type="relative">^build/*</exclude-pattern>
|
|
|
|
|
2017-12-01 04:40:04 +01:00
|
|
|
<!-- Directories and third party library exclusions -->
|
|
|
|
<exclude-pattern>/node_modules/*</exclude-pattern>
|
|
|
|
<exclude-pattern>/vendor/*</exclude-pattern>
|
|
|
|
|
|
|
|
<exclude-pattern>/src/wp-admin/includes/class-ftp*</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-admin/includes/class-pclzip\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-admin/includes/deprecated\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-admin/includes/ms-deprecated\.php</exclude-pattern>
|
|
|
|
|
|
|
|
<exclude-pattern>/src/wp-includes/atomlib\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/class-IXR\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/class-json\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/class-phpass\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/class-phpmailer\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/class-pop3\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/class-requests\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/class-simplepie\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/class-smtp\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/class-snoopy\.php</exclude-pattern>
|
2019-01-12 05:00:42 +01:00
|
|
|
<exclude-pattern>/src/wp-includes/class-wp-block-parser\.php</exclude-pattern>
|
2017-12-01 04:40:04 +01:00
|
|
|
<exclude-pattern>/src/wp-includes/deprecated\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/ms-deprecated\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/pluggable-deprecated\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/rss\.php</exclude-pattern>
|
|
|
|
|
2019-01-12 05:00:42 +01:00
|
|
|
<exclude-pattern>/src/wp-includes/blocks/*</exclude-pattern>
|
2017-12-01 04:40:04 +01:00
|
|
|
<exclude-pattern>/src/wp-includes/ID3/*</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/IXR/*</exclude-pattern>
|
2019-07-03 01:41:16 +02:00
|
|
|
<exclude-pattern>/src/wp-includes/js/*</exclude-pattern>
|
2017-12-01 04:40:04 +01:00
|
|
|
<exclude-pattern>/src/wp-includes/random_compat/*</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/Requests/*</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/SimplePie/*</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-includes/Text/*</exclude-pattern>
|
2019-03-21 06:55:05 +01:00
|
|
|
<exclude-pattern>/src/wp-includes/sodium_compat/*</exclude-pattern>
|
2017-12-01 04:40:04 +01:00
|
|
|
|
2019-01-12 05:00:42 +01:00
|
|
|
<exclude-pattern>/tests/phpunit/includes/speed-trap-listener\.php</exclude-pattern>
|
|
|
|
|
2017-12-01 04:40:04 +01:00
|
|
|
<!-- Test data and fixtures -->
|
|
|
|
<exclude-pattern>/tests/phpunit/build*</exclude-pattern>
|
|
|
|
<exclude-pattern>/tests/phpunit/data/*</exclude-pattern>
|
|
|
|
|
|
|
|
<exclude-pattern>/tools/*</exclude-pattern>
|
|
|
|
|
|
|
|
<!-- Whitelist the WP DB Class and related tests for usage of direct database access functions. -->
|
|
|
|
<rule ref="WordPress.DB.RestrictedFunctions">
|
|
|
|
<exclude-pattern>/src/wp-includes/wp-db\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/tests/phpunit/tests/db/charset\.php</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
|
|
|
|
<!-- Whitelist the WP DB related tests for issues with prepared SQL placeholders
|
|
|
|
(as the handling of those are being tested). -->
|
|
|
|
<rule ref="WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare">
|
|
|
|
<exclude-pattern>/tests/phpunit/tests/db\.php</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
<rule ref="WordPress.DB.PreparedSQLPlaceholders.UnsupportedPlaceholder">
|
|
|
|
<exclude-pattern>/tests/phpunit/tests/db\.php</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
<rule ref="WordPress.DB.PreparedSQLPlaceholders.UnescapedLiteral">
|
|
|
|
<exclude-pattern>/tests/phpunit/tests/db\.php</exclude-pattern>
|
|
|
|
</rule>
|
2018-09-14 09:54:53 +02:00
|
|
|
<rule ref="WordPress.DB.PreparedSQL.NotPrepared">
|
|
|
|
<exclude-pattern>/tests/phpunit/tests/admin/includesSchema\.php</exclude-pattern>
|
2018-09-24 17:22:01 +02:00
|
|
|
<exclude-pattern>/tests/phpunit/tests/multisite/site\.php</exclude-pattern>
|
2018-09-14 09:54:53 +02:00
|
|
|
</rule>
|
2018-06-15 17:56:58 +02:00
|
|
|
|
|
|
|
<!-- Whitelist the I18n functions file from issues identified by the I18n sniff
|
|
|
|
(such as calling the low-level translate() function). -->
|
|
|
|
<rule ref="WordPress.WP.I18n">
|
|
|
|
<exclude-pattern>/src/wp-includes/l10n\.php</exclude-pattern>
|
2019-01-11 07:03:46 +01:00
|
|
|
<exclude-pattern>/tests/phpunit/tests/l10n\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/tests/phpunit/tests/l10n/loadTextdomainJustInTime\.php</exclude-pattern>
|
2018-06-15 17:56:58 +02:00
|
|
|
</rule>
|
2017-12-01 04:40:04 +01:00
|
|
|
|
2019-07-05 10:03:40 +02:00
|
|
|
<!-- Translator comments aren't needed in unit tests. -->
|
|
|
|
<rule ref="WordPress.WP.I18n.MissingTranslatorsComment">
|
|
|
|
<exclude-pattern>/tests/*</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
|
2017-12-01 04:40:04 +01:00
|
|
|
<rule ref="Generic.Functions.FunctionCallArgumentSpacing">
|
|
|
|
<exclude-pattern>/wp-config\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/wp-config-sample\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/wp-tests-config\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/wp-tests-config-sample\.php</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
|
2019-05-28 02:25:42 +02:00
|
|
|
<!-- Exclude checking of line endings when reporting errors, but fix them when running phpcbf.
|
|
|
|
Git and SVN manage these pretty well cross-platform as "native".
|
|
|
|
Whitelist configuration files. -->
|
2018-08-17 03:50:26 +02:00
|
|
|
<rule ref="Generic.Files.LineEndings">
|
|
|
|
<exclude-pattern>/wp-config\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/wp-config-sample\.php</exclude-pattern>
|
2019-05-28 02:25:42 +02:00
|
|
|
<exclude phpcs-only="true" name="Generic.Files.LineEndings"/>
|
2018-08-17 03:50:26 +02:00
|
|
|
</rule>
|
|
|
|
|
2019-01-11 05:59:23 +01:00
|
|
|
<!-- WPCS1620: template.php isn't a template tag file. -->
|
|
|
|
<rule ref="WordPress.Files.FileName.InvalidTemplateTagFileName">
|
|
|
|
<exclude-pattern>/src/wp-includes/template\.php</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
|
2019-01-11 07:16:35 +01:00
|
|
|
<!-- WPCS1621: These files are expected to use _ instead of -. -->
|
|
|
|
<rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
|
|
|
|
<exclude-pattern>/src/_index\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-admin/_index\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-content/themes/twentythirteen/taxonomy-post_format\.php</exclude-pattern>
|
|
|
|
<exclude-pattern>/src/wp-content/themes/twentyfourteen/taxonomy-post_format\.php</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
|
2017-12-01 04:40:04 +01:00
|
|
|
<!-- Whitelist test classes for select sniffs. -->
|
|
|
|
<rule ref="WordPress.Files.FileName">
|
|
|
|
<properties>
|
2019-07-08 02:55:20 +02:00
|
|
|
<property name="custom_test_class_whitelist" type="array">
|
|
|
|
<!-- Test case parent classes -->
|
|
|
|
<element value="WP_UnitTestCase"/>
|
|
|
|
<element value="WP_Ajax_UnitTestCase"/>
|
|
|
|
<element value="WP_Canonical_UnitTestCase"/>
|
|
|
|
<element value="WP_Test_REST_TestCase"/>
|
|
|
|
<element value="WP_Test_REST_Controller_Testcase"/>
|
|
|
|
<element value="WP_Test_REST_Post_Type_Controller_Testcase"/>
|
|
|
|
<element value="WP_XMLRPC_UnitTestCase"/>
|
|
|
|
<element value="WP_Filesystem_UnitTestCase"/>
|
|
|
|
<element value="WP_Image_UnitTestCase"/>
|
|
|
|
<element value="WP_HTTP_UnitTestCase"/>
|
|
|
|
<element value="WP_Tests_Image_Resize_UnitTestCase"/>
|
|
|
|
<element value="WP_Import_UnitTestCase"/>
|
|
|
|
<element value="Tests_Query_Conditionals"/>
|
|
|
|
|
|
|
|
<!-- Mock classes -->
|
|
|
|
<element value="Spy_REST_Server"/>
|
|
|
|
<element value="WP_REST_Test_Controller"/>
|
|
|
|
<element value="WP_Image_Editor_Mock"/>
|
|
|
|
<element value="WP_Filesystem_MockFS"/>
|
|
|
|
<element value="MockPHPMailer"/>
|
|
|
|
<element value="MockAction"/>
|
|
|
|
<element value="WP_Object_Cache"/>
|
|
|
|
|
|
|
|
<!-- PHPUnit helpers -->
|
|
|
|
<element value="TracTickets"/>
|
|
|
|
<element value="WP_PHPUnit_Util_Getopt"/>
|
|
|
|
<element value="PHPUnit_Util_Test"/>
|
|
|
|
<element value="WPProfiler"/>
|
|
|
|
<element value="SpeedTrapListener"/>
|
|
|
|
<element value="PHPUnit_Framework_Exception"/>
|
|
|
|
</property>
|
2017-12-01 04:40:04 +01:00
|
|
|
</properties>
|
|
|
|
</rule>
|
|
|
|
|
2019-07-09 07:44:42 +02:00
|
|
|
<rule ref="WordPress.PHP.NoSilencedErrors">
|
|
|
|
<properties>
|
|
|
|
<property name="custom_whitelist" type="array">
|
|
|
|
<element value="ssh2_connect"/>
|
|
|
|
<element value="ssh2_auth_password"/>
|
|
|
|
<element value="ssh2_auth_pubkey_file"/>
|
|
|
|
<element value="ftp_ssl_connect"/>
|
|
|
|
<element value="ftp_connect"/>
|
|
|
|
<element value="ftp_get_option"/>
|
|
|
|
<element value="ftp_set_option"/>
|
|
|
|
<element value="disk_free_space"/>
|
|
|
|
<element value="getimagesize"/>
|
|
|
|
<element value="iptcparse"/>
|
|
|
|
<element value="exif_read_data"/>
|
|
|
|
<element value="gzinflate"/>
|
|
|
|
<element value="gzuncompress"/>
|
|
|
|
<element value="gzdecode"/>
|
|
|
|
</property>
|
|
|
|
</properties>
|
|
|
|
</rule>
|
|
|
|
|
2019-07-05 05:13:31 +02:00
|
|
|
<!-- Assignments in while conditions are a valid method of looping over iterables -->
|
|
|
|
<rule ref="WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition">
|
|
|
|
<exclude-pattern>*</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
|
2017-12-01 04:40:04 +01:00
|
|
|
<!-- Exclude the unit tests from select sniffs. -->
|
|
|
|
<rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
|
|
|
|
<exclude-pattern>/tests/phpunit/tests/*</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
<rule ref="PEAR.NamingConventions.ValidClassName.Invalid">
|
|
|
|
<exclude-pattern>/tests/phpunit/tests/*</exclude-pattern>
|
|
|
|
</rule>
|
|
|
|
|
|
|
|
</ruleset>
|