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/rest-api/rest-server.php

    r42997 r43571  
    6464
    6565                register_rest_route(
    66                         'test-ns', '/test', array(
     66                        'test-ns',
     67                        '/test',
     68                        array(
    6769                                'methods'  => array( 'GET' ),
    6870                                'callback' => '__return_null',
    … …  
    8486
    8587                register_rest_route(
    86                         'test-ns', '/test', array(
     88                        'test-ns',
     89                        '/test',
     90                        array(
    8791                                'methods'  => array( 'GET' ),
    8892                                'callback' => '__return_null',
    … …  
    104108        public function test_optional_param() {
    105109                register_rest_route(
    106                         'optional', '/test', array(
     110                        'optional',
     111                        '/test',
     112                        array(
    107113                                'methods'  => array( 'GET' ),
    108114                                'callback' => '__return_null',
    … …  
    123129        public function test_no_zero_param() {
    124130                register_rest_route(
    125                         'no-zero', '/test', array(
     131                        'no-zero',
     132                        '/test',
     133                        array(
    126134                                'methods'  => array( 'GET' ),
    127135                                'callback' => '__return_null',
    … …  
    140148        public function test_head_request_handled_by_get() {
    141149                register_rest_route(
    142                         'head-request', '/test', array(
     150                        'head-request',
     151                        '/test',
     152                        array(
    143153                                'methods'  => array( 'GET' ),
    144154                                'callback' => '__return_true',
    … …  
    158168        public function test_explicit_head_callback() {
    159169                register_rest_route(
    160                         'head-request', '/test', array(
     170                        'head-request',
     171                        '/test',
     172                        array(
    161173                                array(
    162174                                        'methods'  => array( 'HEAD' ),
    … …  
    178190
    179191                rest_get_server()->register_route(
    180                         'test', '/test/(?P<data>.*)', array(
     192                        'test',
     193                        '/test/(?P<data>.*)',
     194                        array(
    181195                                array(
    182196                                        'methods'  => WP_REST_Server::READABLE,
    … …  
    200214        function test_rest_route_capability_authorization_fails() {
    201215                register_rest_route(
    202                         'test-ns', '/test', array(
     216                        'test-ns',
     217                        '/test',
     218                        array(
    203219                                'methods'             => 'GET',
    204220                                'callback'            => '__return_null',
    … …  
    220236        function test_rest_route_capability_authorization() {
    221237                register_rest_route(
    222                         'test-ns', '/test', array(
     238                        'test-ns',
     239                        '/test',
     240                        array(
    223241                                'methods'             => 'GET',
    224242                                'callback'            => '__return_null',
    … …  
    246264
    247265                register_rest_route(
    248                         'test-ns', '/test', array(
     266                        'test-ns',
     267                        '/test',
     268                        array(
    249269                                'methods'      => 'GET',
    250270                                'callback'     => '__return_null',
    … …  
    271291
    272292                register_rest_route(
    273                         'test-ns', '/test', array(
     293                        'test-ns',
     294                        '/test',
     295                        array(
    274296                                'methods'      => 'GET',
    275297                                'callback'     => '__return_null',
    … …  
    279301
    280302                register_rest_route(
    281                         'test-ns', '/test', array(
     303                        'test-ns',
     304                        '/test',
     305                        array(
    282306                                'methods'      => 'POST',
    283307                                'callback'     => '__return_null',
    … …  
    305329
    306330                register_rest_route(
    307                         'test-ns', '/test', array(
     331                        'test-ns',
     332                        '/test',
     333                        array(
    308334                                'methods'             => 'GET',
    309335                                'callback'            => '__return_null',
    … …  
    314340
    315341                register_rest_route(
    316                         'test-ns', '/test', array(
     342                        'test-ns',
     343                        '/test',
     344                        array(
    317345                                'methods'      => 'POST',
    318346                                'callback'     => '__return_null',
    … …  
    334362        public function test_allow_header_sent_on_options_request() {
    335363                register_rest_route(
    336                         'test-ns', '/test', array(
     364                        'test-ns',
     365                        '/test',
     366                        array(
    337367                                array(
    338368                                        'methods'  => array( 'GET' ),
    … …  
    469499                // Register our testing route.
    470500                rest_get_server()->register_route(
    471                         'test', '/test/embeddable', array(
     501                        'test',
     502                        '/test/embeddable',
     503                        array(
    472504                                'methods'  => 'GET',
    473505                                'callback' => array( $this, 'embedded_response_callback' ),
    … …  
    542574                // Register our testing route.
    543575                rest_get_server()->register_route(
    544                         'test', '/test/embeddable', array(
     576                        'test',
     577                        '/test/embeddable',
     578                        array(
    545579                                'methods'  => 'GET',
    546580                                'callback' => array( $this, 'embedded_response_callback' ),
    … …  
    563597                // Register our testing route.
    564598                rest_get_server()->register_route(
    565                         'test', '/test/embeddable', array(
     599                        'test',
     600                        '/test/embeddable',
     601                        array(
    566602                                'methods'  => 'GET',
    567603                                'callback' => array( $this, 'embedded_response_callback' ),
    … …  
    589625                // Register our testing route.
    590626                rest_get_server()->register_route(
    591                         'test', '/test/embeddable', array(
     627                        'test',
     628                        '/test/embeddable',
     629                        array(
    592630                                'methods'  => 'GET',
    593631                                'callback' => array( $this, 'embedded_response_callback' ),
    … …  
    684722                $server = new WP_REST_Server();
    685723                $server->register_route(
    686                         'test/example', '/test/example/some-route', array(
     724                        'test/example',
     725                        '/test/example/some-route',
     726                        array(
    687727                                array(
    688728                                        'methods'  => WP_REST_Server::READABLE,
    … …  
    726766                $server = new WP_REST_Server();
    727767                $server->register_route(
    728                         'test/example', '/test/example/some-route', array(
     768                        'test/example',
     769                        '/test/example/some-route',
     770                        array(
    729771                                array(
    730772                                        'methods'  => WP_REST_Server::READABLE,
    … …  
    738780                );
    739781                $server->register_route(
    740                         'test/another', '/test/another/route', array(
     782                        'test/another',
     783                        '/test/another/route',
     784                        array(
    741785                                array(
    742786                                        'methods'  => WP_REST_Server::READABLE,
    … …  
    765809                $server = new WP_REST_Server();
    766810                $server->register_route(
    767                         'test/example', '/test/example/some-route', array(
     811                        'test/example',
     812                        '/test/example/some-route',
     813                        array(
    768814                                array(
    769815                                        'methods'  => WP_REST_Server::READABLE,
    … …  
    773819                );
    774820                $server->register_route(
    775                         'test/another', '/test/another/route', array(
     821                        'test/another',
     822                        '/test/another/route',
     823                        array(
    776824                                array(
    777825                                        'methods'  => WP_REST_Server::READABLE,
    … …  
    856904
    857905                rest_get_server()->register_route(
    858                         'test', '/test/(?P<data>.*)', array(
     906                        'test',
     907                        '/test/(?P<data>.*)',
     908                        array(
    859909                                array(
    860910                                        'methods'  => WP_REST_Server::READABLE,
    … …  
    875925
    876926                rest_get_server()->register_route(
    877                         'test', '/test', array(
     927                        'test',
     928                        '/test',
     929                        array(
    878930                                array(
    879931                                        'methods'  => WP_REST_Server::READABLE,
    … …  
    901953
    902954                rest_get_server()->register_route(
    903                         'test', '/test', array(
     955                        'test',
     956                        '/test',
     957                        array(
    904958                                array(
    905959                                        'methods'  => WP_REST_Server::READABLE,
    … …  
    928982
    929983                rest_get_server()->register_route(
    930                         'test', '/test', array(
     984                        'test',
     985                        '/test',
     986                        array(
    931987                                array(
    932988                                        'methods'  => WP_REST_Server::READABLE,
    … …  
    9541010
    9551011                rest_get_server()->register_route(
    956                         'test', '/test', array(
     1012                        'test',
     1013                        '/test',
     1014                        array(
    9571015                                array(
    9581016                                        'methods'  => WP_REST_Server::READABLE,
    … …  
    9801038
    9811039                rest_get_server()->register_route(
    982                         'test', '/test', array(
     1040                        'test',
     1041                        '/test',
     1042                        array(
    9831043                                array(
    9841044                                        'methods'  => WP_REST_Server::READABLE,
    … …  
    10551115        public function test_rest_validate_before_sanitization() {
    10561116                register_rest_route(
    1057                         'test-ns', '/test', array(
     1117                        'test-ns',
     1118                        '/test',
     1119                        array(
    10581120                                'methods'  => array( 'GET' ),
    10591121                                'callback' => '__return_null',
Note: See TracChangeset for help on using the changeset viewer.