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

@@ -537,7 +537,7 @@ jQuery(document).ready( function($) {
});
});
</script>
<?php
<?php
}
/**
@@ -550,12 +550,12 @@ jQuery(document).ready( function($) {
* @param object $user User data object
*/
function use_ssl_preference( $user ) {
?>
?>
<tr class="user-use-ssl-wrap">
<th scope="row"><?php _e( 'Use https' ); ?></th>
<td><label for="use_ssl"><input name="use_ssl" type="checkbox" id="use_ssl" value="1" <?php checked( '1', $user->use_ssl ); ?> /> <?php _e( 'Always use https when visiting the admin' ); ?></label></td>
</tr>
<?php
<?php
}
/**
@@ -576,7 +576,10 @@ this email. This invitation will expire in a few days.
Please click the following link to activate your user account:
%%s'
), wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ), home_url(), wp_specialchars_decode( translate_user_role( $role['name'] ) )
),
wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ),
home_url(),
wp_specialchars_decode( translate_user_role( $role['name'] ) )
);
}
@@ -627,10 +630,12 @@ function _wp_privacy_completed_request( $request_id ) {
update_post_meta( $request_id, '_wp_user_request_completed_timestamp', time() );
$request = wp_update_post( array(
'ID' => $request_id,
'post_status' => 'request-completed',
) );
$request = wp_update_post(
array(
'ID' => $request_id,
'post_status' => 'request-completed',
)
);
return $request;
}
@@ -753,29 +758,33 @@ function _wp_personal_data_handle_actions() {
*/
function _wp_personal_data_cleanup_requests() {
/** This filter is documented in wp-includes/user.php */
$expires = (int) apply_filters( 'user_request_key_expiration', DAY_IN_SECONDS );
$expires = (int) apply_filters( 'user_request_key_expiration', DAY_IN_SECONDS );
$requests_query = new WP_Query( array(
'post_type' => 'user_request',
'posts_per_page' => -1,
'post_status' => 'request-pending',
'fields' => 'ids',
'date_query' => array(
array(
'column' => 'post_modified_gmt',
'before' => $expires . ' seconds ago',
$requests_query = new WP_Query(
array(
'post_type' => 'user_request',
'posts_per_page' => -1,
'post_status' => 'request-pending',
'fields' => 'ids',
'date_query' => array(
array(
'column' => 'post_modified_gmt',
'before' => $expires . ' seconds ago',
),
),
),
) );
)
);
$request_ids = $requests_query->posts;
foreach ( $request_ids as $request_id ) {
wp_update_post( array(
'ID' => $request_id,
'post_status' => 'request-failed',
'post_password' => '',
) );
wp_update_post(
array(
'ID' => $request_id,
'post_status' => 'request-failed',
'post_password' => '',
)
);
}
}
@@ -796,10 +805,12 @@ function _wp_personal_data_export_page() {
// "Borrow" xfn.js for now so we don't have to create new files.
wp_enqueue_script( 'xfn' );
$requests_table = new WP_Privacy_Data_Export_Requests_Table( array(
'plural' => 'privacy_requests',
'singular' => 'privacy_request',
) );
$requests_table = new WP_Privacy_Data_Export_Requests_Table(
array(
'plural' => 'privacy_requests',
'singular' => 'privacy_request',
)
);
$requests_table->process_bulk_action();
$requests_table->prepare_items();
?>
@@ -867,10 +878,12 @@ function _wp_personal_data_removal_page() {
// "Borrow" xfn.js for now so we don't have to create new files.
wp_enqueue_script( 'xfn' );
$requests_table = new WP_Privacy_Data_Removal_Requests_Table( array(
'plural' => 'privacy_requests',
'singular' => 'privacy_request',
) );
$requests_table = new WP_Privacy_Data_Removal_Requests_Table(
array(
'plural' => 'privacy_requests',
'singular' => 'privacy_request',
)
);
$requests_table->process_bulk_action();
$requests_table->prepare_items();
@@ -1013,7 +1026,7 @@ function _wp_privacy_hook_requests_page() {
*/
function _wp_privacy_requests_screen_options() {
$args = array(
'option' => str_replace( 'tools_page_', '', get_current_screen()->id ) . '_requests_per_page',
'option' => str_replace( 'tools_page_', '', get_current_screen()->id ) . '_requests_per_page',
);
add_screen_option( 'per_page', $args );
}
@@ -1175,8 +1188,8 @@ abstract class WP_Privacy_Requests_Table extends WP_List_Table {
public function process_bulk_action() {
$action = $this->current_action();
$request_ids = isset( $_REQUEST['request_id'] ) ? wp_parse_id_list( wp_unslash( $_REQUEST['request_id'] ) ) : array();
$count = 0;
$count = 0;
if ( $request_ids ) {
check_admin_referer( 'bulk-privacy_requests' );
@@ -1502,10 +1515,18 @@ class WP_Privacy_Data_Export_Requests_Table extends WP_Privacy_Requests_Table {
submit_button( __( 'Retry' ), 'secondary', 'privacy_action_email_retry[' . $item->ID . ']', false );
break;
case 'request-completed':
echo '<a href="' . esc_url( wp_nonce_url( add_query_arg( array(
'action' => 'delete',
'request_id' => array( $item->ID ),
), admin_url( 'tools.php?page=export_personal_data' ) ), 'bulk-privacy_requests' ) ) . '" class="button">' . esc_html__( 'Remove request' ) . '</a>';
echo '<a href="' . esc_url(
wp_nonce_url(
add_query_arg(
array(
'action' => 'delete',
'request_id' => array( $item->ID ),
),
admin_url( 'tools.php?page=export_personal_data' )
),
'bulk-privacy_requests'
)
) . '" class="button">' . esc_html__( 'Remove request' ) . '</a>';
break;
}
}
@@ -1616,10 +1637,18 @@ class WP_Privacy_Data_Removal_Requests_Table extends WP_Privacy_Requests_Table {
submit_button( __( 'Retry' ), 'secondary', 'privacy_action_email_retry[' . $item->ID . ']', false );
break;
case 'request-completed':
echo '<a href="' . esc_url( wp_nonce_url( add_query_arg( array(
'action' => 'delete',
'request_id' => array( $item->ID ),
), admin_url( 'tools.php?page=remove_personal_data' ) ), 'bulk-privacy_requests' ) ) . '" class="button">' . esc_html__( 'Remove request' ) . '</a>';
echo '<a href="' . esc_url(
wp_nonce_url(
add_query_arg(
array(
'action' => 'delete',
'request_id' => array( $item->ID ),
),
admin_url( 'tools.php?page=remove_personal_data' )
),
'bulk-privacy_requests'
)
) . '" class="button">' . esc_html__( 'Remove request' ) . '</a>';
break;
}
}