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/rewrite/oldDateRedirect.php

    r42587 r43571  
    1212
    1313        public static function wpSetUpBeforeClass() {
    14                 self::$post_id = self::factory()->post->create( array(
    15                         'post_title' => 'Foo Bar',
    16                         'post_name'  => 'foo-bar',
    17                 ) );
     14                self::$post_id = self::factory()->post->create(
     15                        array(
     16                                'post_title' => 'Foo Bar',
     17                                'post_name'  => 'foo-bar',
     18                        )
     19                );
    1820
    1921                self::$attachment_id = self::factory()->attachment->create_object(
     
    5052
    5153                $time = '2004-01-03 00:00:00';
    52                 wp_update_post( array(
    53                         'ID'            => self::$post_id,
    54                         'post_date'     => $time,
    55                         'post_date_gmt' => get_gmt_from_date( $time ),
    56                 ) );
     54                wp_update_post(
     55                        array(
     56                                'ID'            => self::$post_id,
     57                                'post_date'     => $time,
     58                                'post_date_gmt' => get_gmt_from_date( $time ),
     59                        )
     60                );
    5761
    5862                $permalink = user_trailingslashit( get_permalink( self::$post_id ) );
     
    6771
    6872                $time = '2004-01-03 00:00:00';
    69                 wp_update_post( array(
    70                         'ID'            => self::$post_id,
    71                         'post_date'     => $time,
    72                         'post_date_gmt' => get_gmt_from_date( $time ),
    73                         'post_name'     => 'bar-baz',
    74                 ) );
     73                wp_update_post(
     74                        array(
     75                                'ID'            => self::$post_id,
     76                                'post_date'     => $time,
     77                                'post_date_gmt' => get_gmt_from_date( $time ),
     78                                'post_name'     => 'bar-baz',
     79                        )
     80                );
    7581
    7682                $permalink = user_trailingslashit( get_permalink( self::$post_id ) );
     
    8591
    8692                $time = '2004-01-03 00:00:00';
    87                 wp_update_post( array(
    88                         'ID'            => self::$post_id,
    89                         'post_date'     => $time,
    90                         'post_date_gmt' => get_gmt_from_date( $time ),
    91                 ) );
     93                wp_update_post(
     94                        array(
     95                                'ID'            => self::$post_id,
     96                                'post_date'     => $time,
     97                                'post_date_gmt' => get_gmt_from_date( $time ),
     98                        )
     99                );
    92100
    93101                $this->go_to( $old_permalink );
     
    98106                $old_permalink = get_attachment_link( self::$attachment_id );
    99107
    100                 wp_update_post( array(
    101                         'ID'        => self::$attachment_id,
    102                         'post_name' => 'the-attachment',
    103                 ) );
     108                wp_update_post(
     109                        array(
     110                                'ID'        => self::$attachment_id,
     111                                'post_name' => 'the-attachment',
     112                        )
     113                );
    104114
    105115                $permalink = user_trailingslashit( trailingslashit( get_permalink( self::$post_id ) ) . 'the-attachment' );
     
    114124
    115125                $time = '2004-01-03 00:00:00';
    116                 wp_update_post( array(
    117                         'ID'            => self::$post_id,
    118                         'post_date'     => $time,
    119                         'post_date_gmt' => get_gmt_from_date( $time ),
    120                         'post_name'     => 'bar-baz',
    121                 ) );
     126                wp_update_post(
     127                        array(
     128                                'ID'            => self::$post_id,
     129                                'post_date'     => $time,
     130                                'post_date_gmt' => get_gmt_from_date( $time ),
     131                                'post_name'     => 'bar-baz',
     132                        )
     133                );
    122134
    123135                $this->go_to( $old_permalink );
     
    128140                $old_permalink = get_attachment_link( self::$attachment_id );
    129141
    130                 wp_update_post( array(
    131                         'ID'        => self::$attachment_id,
    132                         'post_name' => 'the-attachment',
    133                 ) );
     142                wp_update_post(
     143                        array(
     144                                'ID'        => self::$attachment_id,
     145                                'post_name' => 'the-attachment',
     146                        )
     147                );
    134148
    135149                $permalink = user_trailingslashit( trailingslashit( get_permalink( self::$post_id ) ) . 'the-attachment' );
     
    141155
    142156        public function test_old_date_redirect_paged() {
    143                 wp_update_post( array(
    144                         'ID'           => self::$post_id,
    145                         'post_content' => 'Test<!--nextpage-->Test',
    146                 ) );
     157                wp_update_post(
     158                        array(
     159                                'ID'           => self::$post_id,
     160                                'post_content' => 'Test<!--nextpage-->Test',
     161                        )
     162                );
    147163
    148164                $old_permalink = user_trailingslashit( trailingslashit( get_permalink( self::$post_id ) ) . 'page/2' );
    149165
    150166                $time = '2004-01-03 00:00:00';
    151                 wp_update_post( array(
    152                         'ID'            => self::$post_id,
    153                         'post_date'     => $time,
    154                         'post_date_gmt' => get_gmt_from_date( $time ),
    155                 ) );
     167                wp_update_post(
     168                        array(
     169                                'ID'            => self::$post_id,
     170                                'post_date'     => $time,
     171                                'post_date_gmt' => get_gmt_from_date( $time ),
     172                        )
     173                );
    156174
    157175                $permalink = user_trailingslashit( trailingslashit( get_permalink( self::$post_id ) ) . 'page/2' );
     
    163181
    164182        public function test_old_date_slug_redirect_paged() {
    165                 wp_update_post( array(
    166                         'ID'           => self::$post_id,
    167                         'post_content' => 'Test<!--nextpage-->Test',
    168                 ) );
     183                wp_update_post(
     184                        array(
     185                                'ID'           => self::$post_id,
     186                                'post_content' => 'Test<!--nextpage-->Test',
     187                        )
     188                );
    169189
    170190                $old_permalink = user_trailingslashit( trailingslashit( get_permalink( self::$post_id ) ) . 'page/2' );
    171191
    172192                $time = '2004-01-04 12:00:00';
    173                 wp_update_post( array(
    174                         'ID'            => self::$post_id,
    175                         'post_date'     => $time,
    176                         'post_date_gmt' => get_gmt_from_date( $time ),
    177                         'post_name'     => 'bar-baz',
    178                 ) );
     193                wp_update_post(
     194                        array(
     195                                'ID'            => self::$post_id,
     196                                'post_date'     => $time,
     197                                'post_date_gmt' => get_gmt_from_date( $time ),
     198                                'post_name'     => 'bar-baz',
     199                        )
     200                );
    179201
    180202                $permalink = user_trailingslashit( trailingslashit( get_permalink( self::$post_id ) ) . 'page/2' );
     
    189211
    190212                $time = '2004-01-04 12:00:00';
    191                 wp_update_post( array(
    192                         'ID'            => self::$post_id,
    193                         'post_date'     => $time,
    194                         'post_date_gmt' => get_gmt_from_date( $time ),
    195                         'post_name'     => 'bar-baz',
    196                 ) );
    197 
    198                 $new_post_id = self::factory()->post->create( array(
    199                         'post_title' => 'Foo Bar',
    200                         'post_name'  => 'foo-bar',
    201                 ) );
     213                wp_update_post(
     214                        array(
     215                                'ID'            => self::$post_id,
     216                                'post_date'     => $time,
     217                                'post_date_gmt' => get_gmt_from_date( $time ),
     218                                'post_name'     => 'bar-baz',
     219                        )
     220                );
     221
     222                $new_post_id = self::factory()->post->create(
     223                        array(
     224                                'post_title' => 'Foo Bar',
     225                                'post_name'  => 'foo-bar',
     226                        )
     227                );
    202228
    203229                $permalink = user_trailingslashit( get_permalink( $new_post_id ) );
Note: See TracChangeset for help on using the changeset viewer.