Make WordPress Core


Ignore:
Timestamp:
08/17/2018 01:50:26 AM (8 years ago)
Author:
pento
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/functions.php

    r43503 r43571  
    1515                                'yZ'    => 'baba',
    1616                                'a'     => array( 5, 111, 'x' ),
    17                         ), wp_parse_args( $x )
     17                        ),
     18                        wp_parse_args( $x )
    1819                );
    1920                $y = new MockClass;
     
    3536                                'yZ'    => 'baba',
    3637                                'a'     => array( 5, 111, 'x' ),
    37                         ), wp_parse_args( $b )
     38                        ),
     39                        wp_parse_args( $b )
    3840                );
    3941        }
     
    5153                                'yZ'    => 'baba',
    5254                                'a'     => array( 5, 111, 'x' ),
    53                         ), wp_parse_args( $x, $d )
     55                        ),
     56                        wp_parse_args( $x, $d )
    5457                );
    5558                $e = array( '_baba' => 6 );
     
    5962                                'yZ'    => 'baba',
    6063                                'a'     => array( 5, 111, 'x' ),
    61                         ), wp_parse_args( $x, $e )
     64                        ),
     65                        wp_parse_args( $x, $e )
    6266                );
    6367        }
     
    300304                        $this->assertEquals( "$url?foo=1", add_query_arg( array( 'foo' => '1' ), $url ) );
    301305                        $this->assertEquals(
    302                                 "$url?foo=2", add_query_arg(
     306                                "$url?foo=2",
     307                                add_query_arg(
    303308                                        array(
    304309                                                'foo' => '1',
    305310                                                'foo' => '2',
    306                                         ), $url
     311                                        ),
     312                                        $url
    307313                                )
    308314                        );
    309315                        $this->assertEquals(
    310                                 "$url?foo=1&bar=2", add_query_arg(
     316                                "$url?foo=1&bar=2",
     317                                add_query_arg(
    311318                                        array(
    312319                                                'foo' => '1',
    313320                                                'bar' => '2',
    314                                         ), $url
     321                                        ),
     322                                        $url
    315323                                )
    316324                        );
     
    321329                        $this->assertEquals( "$url?foo=1", add_query_arg( array( 'foo' => '1' ) ) );
    322330                        $this->assertEquals(
    323                                 "$url?foo=2", add_query_arg(
     331                                "$url?foo=2",
     332                                add_query_arg(
    324333                                        array(
    325334                                                'foo' => '1',
     
    329338                        );
    330339                        $this->assertEquals(
    331                                 "$url?foo=1&bar=2", add_query_arg(
     340                                "$url?foo=1&bar=2",
     341                                add_query_arg(
    332342                                        array(
    333343                                                'foo' => '1',
     
    345355                        $this->assertEquals( "$url?foo=1#frag", add_query_arg( array( 'foo' => '1' ), $frag_url ) );
    346356                        $this->assertEquals(
    347                                 "$url?foo=2#frag", add_query_arg(
     357                                "$url?foo=2#frag",
     358                                add_query_arg(
    348359                                        array(
    349360                                                'foo' => '1',
    350361                                                'foo' => '2',
    351                                         ), $frag_url
     362                                        ),
     363                                        $frag_url
    352364                                )
    353365                        );
    354366                        $this->assertEquals(
    355                                 "$url?foo=1&bar=2#frag", add_query_arg(
     367                                "$url?foo=1&bar=2#frag",
     368                                add_query_arg(
    356369                                        array(
    357370                                                'foo' => '1',
    358371                                                'bar' => '2',
    359                                         ), $frag_url
     372                                        ),
     373                                        $frag_url
    360374                                )
    361375                        );
     
    366380                        $this->assertEquals( "$url?foo=1#frag", add_query_arg( array( 'foo' => '1' ) ) );
    367381                        $this->assertEquals(
    368                                 "$url?foo=2#frag", add_query_arg(
     382                                "$url?foo=2#frag",
     383                                add_query_arg(
    369384                                        array(
    370385                                                'foo' => '1',
     
    374389                        );
    375390                        $this->assertEquals(
    376                                 "$url?foo=1&bar=2#frag", add_query_arg(
     391                                "$url?foo=1&bar=2#frag",
     392                                add_query_arg(
    377393                                        array(
    378394                                                'foo' => '1',
     
    401417                        $this->assertEquals( "$url&foo=1", add_query_arg( array( 'foo' => '1' ), $url ) );
    402418                        $this->assertEquals(
    403                                 "$url&foo=2", add_query_arg(
     419                                "$url&foo=2",
     420                                add_query_arg(
    404421                                        array(
    405422                                                'foo' => '1',
    406423                                                'foo' => '2',
    407                                         ), $url
     424                                        ),
     425                                        $url
    408426                                )
    409427                        );
    410428                        $this->assertEquals(
    411                                 "$url&foo=1&bar=2", add_query_arg(
     429                                "$url&foo=1&bar=2",
     430                                add_query_arg(
    412431                                        array(
    413432                                                'foo' => '1',
    414433                                                'bar' => '2',
    415                                         ), $url
     434                                        ),
     435                                        $url
    416436                                )
    417437                        );
     
    422442                        $this->assertEquals( "$url&foo=1", add_query_arg( array( 'foo' => '1' ) ) );
    423443                        $this->assertEquals(
    424                                 "$url&foo=2", add_query_arg(
     444                                "$url&foo=2",
     445                                add_query_arg(
    425446                                        array(
    426447                                                'foo' => '1',
     
    430451                        );
    431452                        $this->assertEquals(
    432                                 "$url&foo=1&bar=2", add_query_arg(
     453                                "$url&foo=1&bar=2",
     454                                add_query_arg(
    433455                                        array(
    434456                                                'foo' => '1',
     
    453475                                'foo' => 'bar',
    454476                                '1'   => '2',
    455                         ), '1=1'
     477                        ),
     478                        '1=1'
    456479                );
    457480                $this->assertEquals( '1=2&foo=bar', $url );
     
    12711294                if ( ! is_multisite() ) {
    12721295                        $data = array_merge(
    1273                                 $data, array(
     1296                                $data,
     1297                                array(
    12741298                                        // Standard non-image file.
    12751299                                         array(
Note: See TracChangeset for help on using the changeset viewer.