Make WordPress Core

#62775 closed enhancement (invalid)

line length should generally not exceed 80 characters, and the hard limit is 120 characters.

Reported by: prashantp15108 Owned by:
Priority: normal Milestone:
Component: Interactivity API Version: 6.6
Severity: minor Keywords: dev-feedback needs-patch 2nd-opinion
Cc: Focuses: coding-standards

Description (last modified by sabernhardt)

wp-includes/interactivity-api/class-wp-interactivity-api.php Line 418

Line length should not more than 120 characters as coding guidelines.

Change History (2)

#1 @sabernhardt
18 months ago

  • Description modified (diff)
  • Focuses coding-standards added
  • Keywords 2nd-opinion added
  • Type defect (bug)enhancement
  • Version 6.76.6

Hi and thanks for the ticket!

The line length limit should apply to DocBlocks, not lines with translatable strings.

Splitting the $message line into multiple lines might be an improvement, however.

$message = sprintf(
	/* translators: 1: SVG or MATH HTML tag, 2: Namespace of the interactive block. */
	__( 'Interactivity directives were detected on an incompatible %1$s tag when processing "%2$s". These directives will be ignored in the server side render.' ),
	$tag_name,
	end( $this->namespace_stack )
);

Or the message could go inside _doing_it_wrong() to avoid creating a $message variable.

_doing_it_wrong(
	__METHOD__,
	sprintf(
		/* translators: 1: SVG or MATH HTML tag, 2: Namespace of the interactive block. */
		__( 'Interactivity directives were detected on an incompatible %1$s tag when processing "%2$s". These directives will be ignored in the server side render.' ),
		$tag_name,
		end( $this->namespace_stack )
	),
	'6.6.0'
);

If changing line 418 is valuable, then splitting lines 537 and 564 could be worthwhile too.

#2 @jonsurrell
10 months ago

  • Milestone Awaiting Review
  • Resolutioninvalid
  • Status newclosed

There's not significant value to be gained by making this change.

WordPress has a policy on code refactoring and I don't believe this meets the requirements.

Note: See TracTickets for help on using tickets.