Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
.travis.yml
behat.yml
circle.yml
phpcs.xml.dist
phpunit.xml.dist
bin/
features/
utils/
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ vendor/
*.tar.gz
composer.lock
*.log
phpunit.xml
phpcs.xml
.phpcs.xml
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"wp-cli/db-command": "^1.3 || ^2",
"wp-cli/entity-command": "^1.3 || ^2",
"wp-cli/extension-command": "^1.2 || ^2",
"wp-cli/wp-cli-tests": "^2.0.7"
"wp-cli/wp-cli-tests": "^2.1"
},
"config": {
"process-timeout": 7200,
Expand Down
86 changes: 86 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?xml version="1.0"?>
<ruleset name="WP-CLI-language">
<description>Custom ruleset for WP-CLI language-command</description>

<!--
#############################################################################
COMMAND LINE ARGUMENTS
For help understanding this file: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
For help using PHPCS: https://github.com/squizlabs/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="5.4-"/>

<!-- 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\Language"/><!-- Namespaces. -->
<element value="wpcli_language"/><!-- Global variables and such. -->
</property>
</properties>
</rule>

<!--
#############################################################################
SELECTIVE EXCLUSIONS
#############################################################################
-->

<!-- The objects containing these properties come from the wordpress.org API, so cannot be renamed.
Used in file: CommandWithTranslation.php.
See: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#mixed-case-property-name-exceptions
Related: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1623 -->
<rule ref="WordPress.NamingConventions.ValidVariableName">
<properties>
<property name="customPropertiesWhitelist" type="array">
<element value="Language"/>
<element value="Name"/>
<element value="Type"/>
<element value="Version"/>
</property>
</properties>
</rule>

<!-- Exclude existing namespaces from the prefix rule as it would break BC to prefix them now. -->
<rule ref="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedNamespaceFound">
<exclude-pattern>*/src/WP_CLI/(CommandWithTranslation|LanguagePackUpgrader)\.php$</exclude-pattern>
</rule>

<!-- Exclude existing classes from the prefix rule as it would break BC to prefix them now. -->
<rule ref="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound">
<exclude-pattern>*/src/(Core|Plugin|Site_Switch|Theme)_Language_Command\.php$</exclude-pattern>
<exclude-pattern>*/src/Language_Namespace\.php$</exclude-pattern>
</rule>

</ruleset>
2 changes: 1 addition & 1 deletion src/Core_Language_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public function uninstall( $args, $assoc_args ) {
*
* @subcommand update
*/
public function update( $args, $assoc_args ) {
public function update( $args, $assoc_args ) { // phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod.Found -- Overruling the documentation, so not useless ;-).
parent::update( $args, $assoc_args );
}

Expand Down
1 change: 1 addition & 0 deletions src/Plugin_Language_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ public function update( $args, $assoc_args ) {
* @return array
*/
private function get_all_plugins() {
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Using WP native hook.
return apply_filters( 'all_plugins', get_plugins() );
}
}
4 changes: 4 additions & 0 deletions src/WP_CLI/LanguagePackUpgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ public function download_package( $package ) {
* @param bool $reply Whether to bail without returning the package. Default is false.
* @param string $package The package file name.
* @param \WP_Upgrader $this The WP_Upgrader instance.
*
* @phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Using WP native hook.
*/
$reply = apply_filters( 'upgrader_pre_download', false, $package, $this );
// phpcs:enable

if ( false !== $reply ) {
return $reply;
}
Expand Down