New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faulty Core fixes: Array indentation / value on new line #973

Closed
jrfnl opened this Issue Jun 17, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@jrfnl
Contributor

jrfnl commented Jun 17, 2017

Summary:

When in an associative array, the value is on the next line (long lines), it is normally indented one tab from the key. If the key was indented incorrectly, then after the fixer has run, the value will no longer be indented one tab in from the key.

Most likely cause: WordPress.Arrays.ArrayIndentation only accounts for key indentation, not for values.

Question:

AFAIK, there is no clear guideline for how this type of indentation "should" be done. I can try & adjust the fixer to indent the value one in from the key if the value starts on a new line, but as there is no clear guideline, should this be auto-fixed or not ?

Example:

File: ./src/wp-admin/edit-comments.php around line 174

Source:

get_current_screen()->add_help_tab( array(
'id'		=> 'overview',
'title'		=> __('Overview'),
'content'	=>
	'<p>' . __( 'You can manage comments made on your site similar to the way you manage posts and other content. This screen is customizable in the same ways as other management screens, and you can act on comments using the on-hover action links or the Bulk Actions.' ) . '</p>'
) );

Fixed as:

get_current_screen()->add_help_tab( array(
	'id'        => 'overview',
	'title'     => __( 'Overview' ),
	'content'   =>
	'<p>' . __( 'You can manage comments made on your site similar to the way you manage posts and other content. This screen is customizable in the same ways as other management screens, and you can act on comments using the on-hover action links or the Bulk Actions.' ) . '</p>',
) );

Expected fix:

get_current_screen()->add_help_tab( array(
	'id'        => 'overview',
	'title'     => __( 'Overview' ),
	'content'   =>
		'<p>' . __( 'You can manage comments made on your site similar to the way you manage posts and other content. This screen is customizable in the same ways as other management screens, and you can act on comments using the on-hover action links or the Bulk Actions.' ) . '</p>',
) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment