Coding Standards: Upgrade WPCS to 1.0.0

WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues.

This change includes three notable additions:
- Multiline function calls must now put each parameter on a new line.
- Auto-formatting files is now part of the `grunt precommit` script. 
- Auto-fixable coding standards issues will now cause Travis failures.

Fixes #44600.



git-svn-id: https://develop.svn.wordpress.org/trunk@43571 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast
2018-08-17 01:50:26 +00:00
parent fed48ba3fe
commit a75d153eee
549 changed files with 9936 additions and 6721 deletions

View File

@@ -331,7 +331,7 @@ class Tests_Term_Query extends WP_UnitTestCase {
}
$query = new WP_Term_Query();
$args = array(
$args = array(
'taxonomy' => 'wptests_tax_1',
'object_ids' => $posts,
'fields' => 'all_with_object_id',
@@ -462,7 +462,9 @@ class Tests_Term_Query extends WP_UnitTestCase {
*/
public function test_get_the_terms_should_respect_taxonomy_orderby() {
register_taxonomy(
'wptests_tax', 'post', array(
'wptests_tax',
'post',
array(
'sort' => true,
'args' => array(
'orderby' => 'term_order',
@@ -470,7 +472,8 @@ class Tests_Term_Query extends WP_UnitTestCase {
)
);
$term_ids = self::factory()->term->create_many(
2, array(
2,
array(
'taxonomy' => 'wptests_tax',
)
);
@@ -489,7 +492,9 @@ class Tests_Term_Query extends WP_UnitTestCase {
*/
public function test_wp_get_object_terms_should_respect_taxonomy_orderby() {
register_taxonomy(
'wptests_tax', 'post', array(
'wptests_tax',
'post',
array(
'sort' => true,
'args' => array(
'orderby' => 'term_order',
@@ -497,7 +502,8 @@ class Tests_Term_Query extends WP_UnitTestCase {
)
);
$term_ids = self::factory()->term->create_many(
2, array(
2,
array(
'taxonomy' => 'wptests_tax',
)
);
@@ -541,14 +547,18 @@ class Tests_Term_Query extends WP_UnitTestCase {
wp_set_object_terms( $p, array( $t1, $t2 ), 'wptests_tax' );
$expected = wp_get_post_terms(
$p, 'wptests_tax', array(
$p,
'wptests_tax',
array(
'fields' => 'ids',
)
);
$found1 = array_keys(
wp_get_object_terms(
$p, 'wptests_tax', array(
$p,
'wptests_tax',
array(
'fields' => 'id=>parent',
)
)
@@ -556,7 +566,9 @@ class Tests_Term_Query extends WP_UnitTestCase {
$found2 = array_keys(
wp_get_object_terms(
$p, 'wptests_tax', array(
$p,
'wptests_tax',
array(
'fields' => 'id=>slug',
)
)
@@ -564,7 +576,9 @@ class Tests_Term_Query extends WP_UnitTestCase {
$found3 = array_keys(
wp_get_object_terms(
$p, 'wptests_tax', array(
$p,
'wptests_tax',
array(
'fields' => 'id=>name',
)
)
@@ -656,17 +670,22 @@ class Tests_Term_Query extends WP_UnitTestCase {
public function test_null_term_object_should_be_discarded() {
register_taxonomy( 'wptests_tax', 'post' );
$terms = self::factory()->term->create_many( 3, array(
'taxonomy' => 'wptests_tax',
) );
$terms = self::factory()->term->create_many(
3,
array(
'taxonomy' => 'wptests_tax',
)
);
$this->term_id = $terms[1];
add_filter( 'get_term', array( $this, 'filter_term_to_null' ) );
$found = get_terms( array(
'taxonomy' => 'wptests_tax',
'hide_empty' => false,
) );
$found = get_terms(
array(
'taxonomy' => 'wptests_tax',
'hide_empty' => false,
)
);
remove_filter( 'get_term', array( $this, 'filter_term_to_null' ) );
$expected = array( $terms[0], $terms[2] );
@@ -688,17 +707,22 @@ class Tests_Term_Query extends WP_UnitTestCase {
public function test_error_term_object_should_be_discarded() {
register_taxonomy( 'wptests_tax', 'post' );
$terms = self::factory()->term->create_many( 3, array(
'taxonomy' => 'wptests_tax',
) );
$terms = self::factory()->term->create_many(
3,
array(
'taxonomy' => 'wptests_tax',
)
);
$this->term_id = $terms[1];
add_filter( 'get_term', array( $this, 'filter_term_to_wp_error' ) );
$found = get_terms( array(
'taxonomy' => 'wptests_tax',
'hide_empty' => false,
) );
$found = get_terms(
array(
'taxonomy' => 'wptests_tax',
'hide_empty' => false,
)
);
remove_filter( 'get_term', array( $this, 'filter_term_to_wp_error' ) );
$expected = array( $terms[0], $terms[2] );