mirror of
https://gh.wpcy.net/https://github.com/wp-cli/entity-command.git
synced 2026-06-12 03:20:14 +08:00
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Pascal Birchler <pascalb@google.com>
125 lines
5.7 KiB
XML
125 lines
5.7 KiB
XML
<?xml version="1.0"?>
|
|
<ruleset name="WP-CLI-entity">
|
|
<description>Custom ruleset for WP-CLI entity-command</description>
|
|
|
|
<!--
|
|
#############################################################################
|
|
COMMAND LINE ARGUMENTS
|
|
For help understanding this file: https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
|
|
For help using PHPCS: https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Usage
|
|
#############################################################################
|
|
-->
|
|
|
|
<!-- What to scan. -->
|
|
<file>.</file>
|
|
|
|
<!-- Show progress. -->
|
|
<arg value="p"/>
|
|
|
|
<!-- Strip the filepaths down to the relevant bit. -->
|
|
<arg name="basepath" value="./"/>
|
|
|
|
<!-- Check up to 8 files simultaneously. -->
|
|
<arg name="parallel" value="8"/>
|
|
|
|
<!--
|
|
#############################################################################
|
|
USE THE WP_CLI_CS RULESET
|
|
#############################################################################
|
|
-->
|
|
|
|
<rule ref="WP_CLI_CS"/>
|
|
|
|
<!--
|
|
#############################################################################
|
|
PROJECT SPECIFIC CONFIGURATION FOR SNIFFS
|
|
#############################################################################
|
|
-->
|
|
|
|
<!-- For help understanding the `testVersion` configuration setting:
|
|
https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
|
|
<config name="testVersion" value="7.2-"/>
|
|
|
|
<!-- Verify that everything in the global namespace is either namespaced or prefixed.
|
|
See: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#naming-conventions-prefix-everything-in-the-global-namespace -->
|
|
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
|
|
<properties>
|
|
<property name="prefixes" type="array">
|
|
<element value="WP_CLI\Entity"/><!-- Namespaces. -->
|
|
<element value="wpcli_entity"/><!-- Global variables and such. -->
|
|
<element value="wp_cli_"/><!-- Public WP-CLI hooks. -->
|
|
</property>
|
|
</properties>
|
|
</rule>
|
|
|
|
<!-- Exclude existing classes from the prefix rule as it would break BC to prefix them now. -->
|
|
<rule ref="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedNamespaceFound">
|
|
<exclude-pattern>*/src/WP_CLI/Fetchers/(Comment|Post|Signup|Site|User)\.php$</exclude-pattern>
|
|
<exclude-pattern>*/src/WP_CLI/CommandWith(DBObject|Meta|Terms)\.php$</exclude-pattern>
|
|
</rule>
|
|
|
|
<rule ref="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound">
|
|
<exclude-pattern>*/src/Taxonomy_Command\.php$</exclude-pattern>
|
|
<exclude-pattern>*/src/Comment(_Meta)?_Command\.php$</exclude-pattern>
|
|
<exclude-pattern>*/src/Font(_Collection|_Face|_Family)?_Command\.php$</exclude-pattern>
|
|
<exclude-pattern>*/src/Font_Namespace\.php$</exclude-pattern>
|
|
<exclude-pattern>*/src/Menu(_Item|_Location)?_Command\.php$</exclude-pattern>
|
|
<exclude-pattern>*/src/Network_Meta_Command\.php$</exclude-pattern>
|
|
<exclude-pattern>*/src/Network_Namespace\.php$</exclude-pattern>
|
|
<exclude-pattern>*/src/Option_Command\.php$</exclude-pattern>
|
|
<exclude-pattern>*/src/Post(_Block|_Meta|_Revision|_Term|_Type)?_Command\.php$</exclude-pattern>
|
|
<exclude-pattern>*/src/Signup_Command\.php$</exclude-pattern>
|
|
<exclude-pattern>*/src/Site(_Meta|_Option)?_Command\.php$</exclude-pattern>
|
|
<exclude-pattern>*/src/Term(_Meta)?_Command\.php$</exclude-pattern>
|
|
<exclude-pattern>*/src/User(_Application_Password|_Meta|_Privacy_Request|_Session|_Term)?_Command\.php$</exclude-pattern>
|
|
</rule>
|
|
|
|
<!-- Whitelisting to provide backward compatibility to classes possibly extending this class. -->
|
|
<rule ref="PSR2.Methods.MethodDeclaration.Underscore">
|
|
<exclude-pattern>*/src/WP_CLI/CommandWithDBObject\.php$</exclude-pattern>
|
|
</rule>
|
|
|
|
<!--
|
|
#############################################################################
|
|
POLYFILL FILES EXCLUSIONS
|
|
These files are copies/adaptations of WordPress core code and must maintain
|
|
compatibility with the original implementation.
|
|
#############################################################################
|
|
-->
|
|
|
|
<!-- Exclude polyfill files from prefix rules - they must match WordPress core class names -->
|
|
<rule ref="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound">
|
|
<exclude-pattern>*/src/Compat/WP_Block_Processor\.php$</exclude-pattern>
|
|
<exclude-pattern>*/src/Compat/WP_HTML_Span\.php$</exclude-pattern>
|
|
</rule>
|
|
|
|
<!-- Exclude polyfill files from PHP compatibility checks - polyfills handle older PHP -->
|
|
<rule ref="PHPCompatibility.FunctionUse.NewFunctions.str_ends_withFound">
|
|
<exclude-pattern>*/src/Compat/*</exclude-pattern>
|
|
<exclude-pattern>*/tests/Compat/PolyfillsTest\.php$</exclude-pattern>
|
|
</rule>
|
|
<rule ref="PHPCompatibility.FunctionUse.NewFunctions.str_starts_withFound">
|
|
<exclude-pattern>*/src/Compat/*</exclude-pattern>
|
|
<exclude-pattern>*/tests/Compat/PolyfillsTest\.php$</exclude-pattern>
|
|
</rule>
|
|
<rule ref="PHPCompatibility.FunctionUse.NewFunctions.str_containsFound">
|
|
<exclude-pattern>*/src/Compat/*</exclude-pattern>
|
|
<exclude-pattern>*/tests/Compat/PolyfillsTest\.php$</exclude-pattern>
|
|
</rule>
|
|
|
|
<!-- Exclude GOTO usage in polyfill - copied from WordPress core -->
|
|
<rule ref="Generic.PHP.DiscourageGoto.Found">
|
|
<exclude-pattern>*/src/Compat/WP_Block_Processor\.php$</exclude-pattern>
|
|
</rule>
|
|
|
|
<!-- Exclude unreachable code warnings in polyfill - due to GOTO control flow -->
|
|
<rule ref="Squiz.PHP.NonExecutableCode.Unreachable">
|
|
<exclude-pattern>*/src/Compat/WP_Block_Processor\.php$</exclude-pattern>
|
|
</rule>
|
|
|
|
<!-- Exclude bootstrap files from global variable prefix rules -->
|
|
<rule ref="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound">
|
|
<exclude-pattern>*/tests/bootstrap\.php$</exclude-pattern>
|
|
</rule>
|
|
|
|
</ruleset>
|