[wp-trac] [WordPress Trac] #62775: line length should generally not exceed 80 characters, and the hard limit is 120 characters.

WordPress Trac noreply at wordpress.org
Wed Mar 19 15:41:02 UTC 2025


#62775: line length should generally not exceed 80 characters, and the hard limit
is 120 characters.
-------------------------------------------------+-------------------------
 Reporter:  prashantp15108                       |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  Interactivity API                    |     Version:  6.6
 Severity:  minor                                |  Resolution:
 Keywords:  dev-feedback needs-patch 2nd-        |     Focuses:  coding-
  opinion                                        |  standards
-------------------------------------------------+-------------------------
Changes (by sabernhardt):

 * keywords:  dev-feedback needs-patch => dev-feedback needs-patch 2nd-
               opinion
 * focuses:   => coding-standards
 * type:  defect (bug) => enhancement
 * version:  6.7 => 6.6


Old description:

> wp-includes/interactivity-api/class-wp-interactivity-api.php Line #418,
>
> Line length should not more then 120 characters as coding guidlines.

New description:

 [https://core.trac.wordpress.org/browser/tags/6.7/src/wp-includes
 /interactivity-api/class-wp-interactivity-api.php?marks=418#L417 wp-
 includes/interactivity-api/class-wp-interactivity-api.php Line 418]

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

--

Comment:

 Hi and thanks for the ticket!

 The [https://developer.wordpress.org/coding-standards/inline-
 documentation-standards/php/#formatting-guidelines 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
 [https://core.trac.wordpress.org/browser/trunk/src/wp-includes
 /interactivity-api/class-wp-interactivity-
 api.php?rev=59477&marks=536-538,563-565#L534 lines 537 and 564] could be
 worthwhile too.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62775#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list