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

@@ -102,7 +102,7 @@ function setup_config_display_header( $body_classes = array() ) {
}
header( 'Content-Type: text/html; charset=utf-8' );
?>
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"<?php echo $dir_attr; ?>>
<head>
@@ -114,7 +114,7 @@ function setup_config_display_header( $body_classes = array() ) {
</head>
<body class="<?php echo implode( ' ', $body_classes ); ?>">
<p id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>" tabindex="-1"><?php _e( 'WordPress' ); ?></a></p>
<?php
<?php
} // end function setup_config_display_header();
$language = '';
@@ -154,7 +154,7 @@ switch ( $step ) {
if ( ! empty( $loaded_language ) ) {
$step_1 .= '&amp;language=' . $loaded_language;
}
?>
?>
<h1 class="screen-reader-text"><?php _e( 'Before getting started' ); ?></h1>
<p><?php _e( 'Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.' ); ?></p>
<ol>
@@ -165,35 +165,35 @@ switch ( $step ) {
<li><?php _e( 'Table prefix (if you want to run more than one WordPress in a single database)' ); ?></li>
</ol>
<p>
<?php
/* translators: %s: wp-config.php */
printf(
__( 'We&#8217;re going to use this information to create a %s file.' ),
'<code>wp-config.php</code>'
);
?>
<?php
/* translators: %s: wp-config.php */
printf(
__( 'We&#8217;re going to use this information to create a %s file.' ),
'<code>wp-config.php</code>'
);
?>
<strong>
<?php
<?php
/* translators: 1: wp-config-sample.php, 2: wp-config.php */
printf(
__( 'If for any reason this automatic file creation doesn&#8217;t work, don&#8217;t worry. All this does is fill in the database information to a configuration file. You may also simply open %1$s in a text editor, fill in your information, and save it as %2$s.' ),
'<code>wp-config-sample.php</code>',
'<code>wp-config.php</code>'
);
?>
?>
</strong>
<?php
/* translators: %s: Codex URL */
printf(
__( 'Need more help? <a href="%s">We got it</a>.' ),
__( 'https://codex.wordpress.org/Editing_wp-config.php' )
);
?>
<?php
/* translators: %s: Codex URL */
printf(
__( 'Need more help? <a href="%s">We got it</a>.' ),
__( 'https://codex.wordpress.org/Editing_wp-config.php' )
);
?>
</p>
<p><?php _e( 'In all likelihood, these items were supplied to you by your Web Host. If you don&#8217;t have this information, then you will need to contact them before you can continue. If you&#8217;re all ready&hellip;' ); ?></p>
<p class="step"><a href="<?php echo $step_1; ?>" class="button button-large"><?php _e( 'Let&#8217;s go!' ); ?></a></p>
<?php
<?php
break;
case 1:
@@ -201,7 +201,7 @@ switch ( $step ) {
$GLOBALS['wp_locale'] = new WP_Locale();
setup_config_display_header();
?>
?>
<h1 class="screen-reader-text"><?php _e( 'Set up your database connection' ); ?></h1>
<form method="post" action="setup-config.php?step=2">
<p><?php _e( 'Below you should enter your database connection details. If you&#8217;re not sure about these, contact your host.' ); ?></p>
@@ -237,14 +237,14 @@ switch ( $step ) {
<td><?php _e( 'If you want to run multiple WordPress installations in a single database, change this.' ); ?></td>
</tr>
</table>
<?php
if ( isset( $_GET['noapi'] ) ) {
?>
<?php
if ( isset( $_GET['noapi'] ) ) {
?>
<input name="noapi" type="hidden" value="1" /><?php } ?>
<input type="hidden" name="language" value="<?php echo esc_attr( $language ); ?>" />
<p class="step"><input name="submit" type="submit" value="<?php echo htmlspecialchars( __( 'Submit' ), ENT_QUOTES ); ?>" class="button button-large" /></p>
</form>
<?php
<?php
break;
case 2:
@@ -387,24 +387,24 @@ switch ( $step ) {
if ( ! is_writable( ABSPATH ) ) :
setup_config_display_header();
?>
?>
<p>
<?php
/* translators: %s: wp-config.php */
printf( __( 'Sorry, but I can&#8217;t write the %s file.' ), '<code>wp-config.php</code>' );
?>
<?php
/* translators: %s: wp-config.php */
printf( __( 'Sorry, but I can&#8217;t write the %s file.' ), '<code>wp-config.php</code>' );
?>
</p>
<p>
<?php
/* translators: %s: wp-config.php */
printf( __( 'You can create the %s file manually and paste the following text into it.' ), '<code>wp-config.php</code>' );
<?php
/* translators: %s: wp-config.php */
printf( __( 'You can create the %s file manually and paste the following text into it.' ), '<code>wp-config.php</code>' );
$config_text = '';
$config_text = '';
foreach ( $config_file as $line ) {
$config_text .= htmlentities( $line, ENT_COMPAT, 'UTF-8' );
}
?>
foreach ( $config_file as $line ) {
$config_text .= htmlentities( $line, ENT_COMPAT, 'UTF-8' );
}
?>
</p>
<textarea id="wp-config" cols="98" rows="15" class="code" readonly="readonly"><?php echo $config_text; ?></textarea>
<p><?php _e( 'After you&#8217;ve done that, click &#8220;Run the installation.&#8221;' ); ?></p>
@@ -418,7 +418,7 @@ if ( ! /iPad|iPod|iPhone/.test( navigator.userAgent ) ) {
}
})();
</script>
<?php
<?php
else :
/*
* If this file doesn't exist, then we are using the wp-config-sample.php
@@ -437,12 +437,12 @@ if ( ! /iPad|iPod|iPhone/.test( navigator.userAgent ) ) {
fclose( $handle );
chmod( $path_to_wp_config, 0666 );
setup_config_display_header();
?>
?>
<h1 class="screen-reader-text"><?php _e( 'Successful database connection' ); ?></h1>
<p><?php _e( 'All right, sparky! You&#8217;ve made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to&hellip;' ); ?></p>
<p class="step"><a href="<?php echo $install; ?>" class="button button-large"><?php _e( 'Run the installation' ); ?></a></p>
<?php
<?php
endif;
break;
}