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
+23 -12
View File
@@ -1552,7 +1552,9 @@ function img_caption_shortcode( $attr, $content = null ) {
'width' => '',
'caption' => '',
'class' => '',
), $attr, 'caption'
),
$attr,
'caption'
);
$atts['width'] = (int) $atts['width'];
@@ -1722,7 +1724,9 @@ function gallery_shortcode( $attr ) {
'include' => '',
'exclude' => '',
'link' => '',
), $attr, 'gallery'
),
$attr,
'gallery'
);
$id = intval( $atts['id'] );
@@ -1897,7 +1901,7 @@ function gallery_shortcode( $attr ) {
* @since 3.9.0
*/
function wp_underscore_playlist_templates() {
?>
?>
<script type="text/html" id="tmpl-wp-playlist-current-item">
<# if ( data.image ) { #>
<img src="{{ data.thumb.src }}" alt="" />
@@ -1936,7 +1940,7 @@ function wp_underscore_playlist_templates() {
<# } #>
</div>
</script>
<?php
<?php
}
/**
@@ -1949,9 +1953,9 @@ function wp_underscore_playlist_templates() {
function wp_playlist_scripts( $type ) {
wp_enqueue_style( 'wp-mediaelement' );
wp_enqueue_script( 'wp-playlist' );
?>
?>
<!--[if lt IE 9]><script>document.createElement('<?php echo esc_js( $type ); ?>');</script><![endif]-->
<?php
<?php
add_action( 'wp_footer', 'wp_underscore_playlist_templates', 0 );
add_action( 'admin_footer', 'wp_underscore_playlist_templates', 0 );
}
@@ -2039,7 +2043,9 @@ function wp_playlist_shortcode( $attr ) {
'tracknumbers' => true,
'images' => true,
'artists' => true,
), $attr, 'playlist'
),
$attr,
'playlist'
);
$id = intval( $atts['id'] );
@@ -2188,7 +2194,7 @@ function wp_playlist_shortcode( $attr ) {
<<?php echo $safe_type; ?> controls="controls" preload="none" width="
<?php
echo (int) $theme_width;
?>
?>
"
<?php
if ( 'video' === $safe_type ) :
@@ -3294,7 +3300,8 @@ function wp_prepare_attachment_for_js( $attachment ) {
/** This filter is documented in wp-admin/includes/media.php */
$possible_sizes = apply_filters(
'image_size_names_choose', array(
'image_size_names_choose',
array(
'thumbnail' => __( 'Thumbnail' ),
'medium' => __( 'Medium' ),
'large' => __( 'Large' ),
@@ -3560,7 +3567,8 @@ function wp_enqueue_media( $args = array() ) {
FROM $wpdb->posts
WHERE post_type = %s
ORDER BY post_date DESC
", 'attachment'
",
'attachment'
)
);
}
@@ -4126,7 +4134,7 @@ function wp_media_personal_data_exporter( $email_address, $page = 1 ) {
$data_to_export = array();
$user = get_user_by( 'email' , $email_address );
$user = get_user_by( 'email', $email_address );
if ( false === $user ) {
return array(
'data' => $data_to_export,
@@ -4151,7 +4159,10 @@ function wp_media_personal_data_exporter( $email_address, $page = 1 ) {
if ( $attachment_url ) {
$post_data_to_export = array(
array( 'name' => __( 'URL' ), 'value' => $attachment_url ),
array(
'name' => __( 'URL' ),
'value' => $attachment_url,
),
);
$data_to_export[] = array(