Make WordPress Core

Opened 3 months ago

Last modified 15 hours ago

#62775 new enhancement

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

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

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 (1)

#1 @sabernhardt
15 hours ago

  • Description modified (diff)
  • Focuses coding-standards added
  • Keywords 2nd-opinion added
  • Type changed from defect (bug) to enhancement
  • Version changed from 6.7 to 6.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.

Note: See TracTickets for help on using tickets.