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.


Built from https://develop.svn.wordpress.org/trunk@43571


git-svn-id: http://core.svn.wordpress.org/trunk@43400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2018-08-17 01:51:36 +00:00
parent d3dee15477
commit f7d8a35517
15 changed files with 77 additions and 72 deletions

View File

@ -71,7 +71,7 @@ get_header(); ?>
<?php
while ( have_posts() ) :
the_post();
?>
?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>

View File

@ -31,7 +31,8 @@ if ( post_password_required() ) {
<?php
printf(
_n( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'twentytwelve' ),
number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>'
number_format_i18n( get_comments_number() ),
'<span>' . get_the_title() . '</span>'
);
?>
</h2>
@ -44,7 +45,7 @@ if ( post_password_required() ) {
'style' => 'ol',
)
);
?>
?>
</ol><!-- .commentlist -->
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>

View File

@ -25,7 +25,7 @@
'after' => '</div>',
)
);
?>
?>
</div><!-- .entry-content -->
<footer class="entry-meta">
<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>

View File

@ -51,7 +51,7 @@
'after' => '</div>',
)
);
?>
?>
</div><!-- .entry-content -->
<?php endif; ?>

View File

@ -69,7 +69,8 @@ function twentytwelve_setup() {
* and here we also set up the default background color.
*/
add_theme_support(
'custom-background', array(
'custom-background',
array(
'default-color' => 'e6e6e6',
)
);
@ -395,7 +396,8 @@ if ( ! function_exists( 'twentytwelve_comment' ) ) :
<?php
comment_reply_link(
array_merge(
$args, array(
$args,
array(
'reply_text' => __( 'Reply', 'twentytwelve' ),
'after' => ' <span>&darr;</span>',
'depth' => $depth,
@ -403,7 +405,7 @@ if ( ! function_exists( 'twentytwelve_comment' ) ) :
)
)
);
?>
?>
</div><!-- .reply -->
</article><!-- #comment-## -->
<?php
@ -551,14 +553,16 @@ function twentytwelve_customize_register( $wp_customize ) {
if ( isset( $wp_customize->selective_refresh ) ) {
$wp_customize->selective_refresh->add_partial(
'blogname', array(
'blogname',
array(
'selector' => '.site-title > a',
'container_inclusive' => false,
'render_callback' => 'twentytwelve_customize_partial_blogname',
)
);
$wp_customize->selective_refresh->add_partial(
'blogdescription', array(
'blogdescription',
array(
'selector' => '.site-description',
'container_inclusive' => false,
'render_callback' => 'twentytwelve_customize_partial_blogdescription',

View File

@ -49,7 +49,7 @@
'menu_class' => 'nav-menu',
)
);
?>
?>
</nav><!-- #site-navigation -->
<?php if ( get_header_image() ) : ?>

View File

@ -17,7 +17,7 @@ get_header(); ?>
<?php
while ( have_posts() ) :
the_post();
?>
?>
<article id="post-<?php the_ID(); ?>" <?php post_class( 'image-attachment' ); ?>>
<header class="entry-header">
@ -51,12 +51,12 @@ get_header(); ?>
<div class="entry-attachment">
<div class="attachment">
<?php
/*
<?php
/*
* Grab the IDs of all the image attachments in a gallery so we can get the URL of the next adjacent image in a gallery,
* or the first image (if we're looking at the last image in a gallery), or, in a gallery of one, just the link to that image file
*/
$attachments = array_values(
$attachments = array_values(
get_children(
array(
'post_parent' => $post->post_parent,
@ -67,15 +67,15 @@ $attachments = array_values(
'orderby' => 'menu_order ID',
)
)
);
foreach ( $attachments as $k => $attachment ) :
);
foreach ( $attachments as $k => $attachment ) :
if ( $attachment->ID == $post->ID ) {
break;
}
endforeach;
// If there is more than 1 attachment in a gallery
if ( count( $attachments ) > 1 ) :
// If there is more than 1 attachment in a gallery
if ( count( $attachments ) > 1 ) :
$k++;
if ( isset( $attachments[ $k ] ) ) :
// get the URL of the next image attachment
@ -124,7 +124,7 @@ endif;
'after' => '</div>',
)
);
?>
?>
</div><!-- .entry-description -->
</div><!-- .entry-content -->

View File

@ -107,7 +107,7 @@ function twentytwelve_header_style() {
* @since Twenty Twelve 1.0
*/
function twentytwelve_admin_header_style() {
?>
?>
<style type="text/css" id="twentytwelve-admin-header-css">
.appearance_page_custom-header #headimg {
border: none;
@ -138,7 +138,7 @@ function twentytwelve_admin_header_style() {
max-width: <?php echo get_theme_support( 'custom-header', 'max-width' ); ?>px;
}
</style>
<?php
<?php
}
/**
@ -164,5 +164,5 @@ function twentytwelve_admin_header_image() {
<img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo esc_attr( get_custom_header()->width ); ?>" height="<?php echo esc_attr( get_custom_header()->height ); ?>" alt="" />
<?php endif; ?>
</div>
<?php
<?php
}

View File

@ -24,7 +24,7 @@ get_header(); ?>
<?php
while ( have_posts() ) :
the_post();
?>
?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>

View File

@ -20,7 +20,7 @@ get_header(); ?>
<?php
while ( have_posts() ) :
the_post();
?>
?>
<?php if ( has_post_thumbnail() ) : ?>
<div class="entry-page-image">
<?php the_post_thumbnail(); ?>

View File

@ -22,7 +22,7 @@ get_header(); ?>
<?php
while ( have_posts() ) :
the_post();
?>
?>
<?php get_template_part( 'content', 'page' ); ?>
<?php comments_template( '', true ); ?>
<?php endwhile; // end of the loop. ?>

View File

@ -20,7 +20,7 @@ get_header(); ?>
<?php
while ( have_posts() ) :
the_post();
?>
?>
<?php get_template_part( 'content', 'page' ); ?>
<?php comments_template( '', true ); ?>
<?php endwhile; // end of the loop. ?>

View File

@ -24,7 +24,7 @@ get_header(); ?>
<?php
while ( have_posts() ) :
the_post();
?>
?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>

View File

@ -15,7 +15,7 @@ get_header(); ?>
<?php
while ( have_posts() ) :
the_post();
?>
?>
<?php get_template_part( 'content', get_post_format() ); ?>