Skip to content

Allow lines to be longer than 80 chars if they're the first line in multi-line comments or part of annotations #3938

Open
@mfrieling

Description

@mfrieling

This is a follow-up to #766 where the reason for too long lines in comments was basically the line containing an url.

I would like to discuss extending this enhancement to the first line of a multi-line comment, also known as the short description. Assume the following example of a class in Drupal 10:

/**
 * Provides a configurable slideshow block, used on static pages if they are top-level in the menu.
 *
 * @Block(
 *   id = "slideshow_block",
 *   admin_label = @Translation("Slideshow block on static pages."
 * )
 */
class CustomSlideshowBlock extends BlockBase {
}

The short description is 96 characters long (excluding the <space>*<space>) and would be broken up into two lines. But that would cause the sniff Drupal.Commenting.DocComment.ShortSingleLine (Doc comment short description must be on a single line, further text should be a separate paragraph) to trigger an error. In some cases it is just not possible to make the short description of a class or function fitting the maximum line length, if special naming or wording of things (coming from the technology used like Drupal, from the customer's/project's business domain or similar).

And in the case of the admin_label line, if the text provided to @Translation() should be longer that would exceed the maximum line length as well. As @PortNumber53 mentioned in a comment to #766 breaking the lines inside of annotations does not always work well.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions