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

@@ -130,14 +130,16 @@ function wptexturize( $text, $reset = false ) {
* lines of code 'til we have enough of 'em, then we need to insert apostrophes instead of quotes.
*/
$cockney = explode(
',', _x(
',',
_x(
"'tain't,'twere,'twas,'tis,'twill,'til,'bout,'nuff,'round,'cause,'em",
'Comma-separated list of words to texturize in your language'
)
);
$cockneyreplace = explode(
',', _x(
',',
_x(
'’tain’t,’twere,’twas,’tis,’twill,’til,’bout,’nuff,’round,’cause,’em',
'Comma-separated list of replacement words in your language'
)
@@ -2262,7 +2264,9 @@ function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'displa
'%cc%80',
'%cc%84',
'%cc%8c',
), '', $title
),
'',
$title
);
// Convert times to x
@@ -3072,12 +3076,12 @@ function wp_targeted_link_rel_callback( $matches ) {
}
if ( ! empty( $rel_match[0] ) ) {
$parts = preg_split( '|\s+|', strtolower( $rel_match[2] ) );
$parts = array_map( 'esc_attr', $parts );
$needed = explode( ' ', $rel );
$parts = array_unique( array_merge( $parts, $needed ) );
$parts = preg_split( '|\s+|', strtolower( $rel_match[2] ) );
$parts = array_map( 'esc_attr', $parts );
$needed = explode( ' ', $rel );
$parts = array_unique( array_merge( $parts, $needed ) );
$delimiter = trim( $rel_match[1] ) ? $rel_match[1] : '"';
$rel = 'rel=' . $delimiter . trim( implode( ' ', $parts ) ) . $delimiter;
$rel = 'rel=' . $delimiter . trim( implode( ' ', $parts ) ) . $delimiter;
$link_html = str_replace( $rel_match[0], $rel, $link_html );
} else {
$link_html .= " rel=\"$rel\"";
@@ -4843,7 +4847,8 @@ function wp_sprintf_l( $pattern, $args ) {
* @param array $delimiters An array of translated delimiters.
*/
$l = apply_filters(
'wp_sprintf_l', array(
'wp_sprintf_l',
array(
/* translators: used to join items in a list with more than 2 items */
'between' => sprintf( __( '%1$s, %2$s' ), '', '' ),
/* translators: used to join last two items in a list with more than 2 times */
@@ -5336,7 +5341,7 @@ function print_emoji_styles() {
}
$printed = true;
?>
?>
<style type="text/css">
img.wp-smiley,
img.emoji {
@@ -5351,7 +5356,7 @@ img.emoji {
padding: 0 !important;
}
</style>
<?php
<?php
}
/**