|
| 1 | +<?xml version="1.0"?> |
| 2 | +<ruleset name="WP-CLI-language"> |
| 3 | + <description>Custom ruleset for WP-CLI language-command</description> |
| 4 | + |
| 5 | + <!-- |
| 6 | + ############################################################################# |
| 7 | + COMMAND LINE ARGUMENTS |
| 8 | + For help understanding this file: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml |
| 9 | + For help using PHPCS: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage |
| 10 | + ############################################################################# |
| 11 | + --> |
| 12 | + |
| 13 | + <!-- What to scan. --> |
| 14 | + <file>.</file> |
| 15 | + |
| 16 | + <!-- Show progress. --> |
| 17 | + <arg value="p"/> |
| 18 | + |
| 19 | + <!-- Strip the filepaths down to the relevant bit. --> |
| 20 | + <arg name="basepath" value="./"/> |
| 21 | + |
| 22 | + <!-- Check up to 8 files simultaneously. --> |
| 23 | + <arg name="parallel" value="8"/> |
| 24 | + |
| 25 | + <!-- |
| 26 | + ############################################################################# |
| 27 | + USE THE WP_CLI_CS RULESET |
| 28 | + ############################################################################# |
| 29 | + --> |
| 30 | + |
| 31 | + <rule ref="WP_CLI_CS"/> |
| 32 | + |
| 33 | + <!-- |
| 34 | + ############################################################################# |
| 35 | + PROJECT SPECIFIC CONFIGURATION FOR SNIFFS |
| 36 | + ############################################################################# |
| 37 | + --> |
| 38 | + |
| 39 | + <!-- For help understanding the `testVersion` configuration setting: |
| 40 | + https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions --> |
| 41 | + <config name="testVersion" value="5.4-"/> |
| 42 | + |
| 43 | + <!-- Verify that everything in the global namespace is either namespaced or prefixed. |
| 44 | + See: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#naming-conventions-prefix-everything-in-the-global-namespace --> |
| 45 | + <rule ref="WordPress.NamingConventions.PrefixAllGlobals"> |
| 46 | + <properties> |
| 47 | + <property name="prefixes" type="array"> |
| 48 | + <element value="WP_CLI\Language"/><!-- Namespaces. --> |
| 49 | + <element value="wpcli_language"/><!-- Global variables and such. --> |
| 50 | + </property> |
| 51 | + </properties> |
| 52 | + </rule> |
| 53 | + |
| 54 | + <!-- |
| 55 | + ############################################################################# |
| 56 | + SELECTIVE EXCLUSIONS |
| 57 | + ############################################################################# |
| 58 | + --> |
| 59 | + |
| 60 | + <!-- The objects containing these properties come from the wordpress.org API, so cannot be renamed. |
| 61 | + Used in file: CommandWithTranslation.php. |
| 62 | + See: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#mixed-case-property-name-exceptions |
| 63 | + Related: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1623 --> |
| 64 | + <rule ref="WordPress.NamingConventions.ValidVariableName"> |
| 65 | + <properties> |
| 66 | + <property name="customPropertiesWhitelist" type="array"> |
| 67 | + <element value="Language"/> |
| 68 | + <element value="Name"/> |
| 69 | + <element value="Type"/> |
| 70 | + <element value="Version"/> |
| 71 | + </property> |
| 72 | + </properties> |
| 73 | + </rule> |
| 74 | + |
| 75 | + <!-- Exclude existing namespaces from the prefix rule as it would break BC to prefix them now. --> |
| 76 | + <rule ref="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedNamespaceFound"> |
| 77 | + <exclude-pattern>*/src/WP_CLI/(CommandWithTranslation|LanguagePackUpgrader)\.php$</exclude-pattern> |
| 78 | + </rule> |
| 79 | + |
| 80 | + <!-- Exclude existing classes from the prefix rule as it would break BC to prefix them now. --> |
| 81 | + <rule ref="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound"> |
| 82 | + <exclude-pattern>*/src/(Core|Plugin|Site_Switch|Theme)_Language_Command\.php$</exclude-pattern> |
| 83 | + <exclude-pattern>*/src/Language_Namespace\.php$</exclude-pattern> |
| 84 | + </rule> |
| 85 | + |
| 86 | +</ruleset> |
0 commit comments