Skip to content

Proposal: Change docblock line wrapping to 120 characters #146

Open
@johnbillion

Description

@johnbillion

I am proposing that the "Line wrapping" guideline for docblocks in PHP and JavaScript files is changed so it is fixed at 120 characters. The current guideline is:

DocBlock text should wrap to the next line after 80 characters of text. If the DocBlock itself is indented on the left 20 character positions, the wrap could occur at position 100, but should not extend beyond a total of 120 characters wide.

Issue Description

80 characters is very narrow. A large proportion of docblocks in WordPress core don't adhere to this, especially when it comes to @param tags with detailed documentation and array arguments which use the extended @type syntax. If the line length limit is assumed to be 80 characters then it's possible for over half the length to be taken up before the description starts.

URL of the Page with the Issue

  1. https://developer.wordpress.org/coding-standards/inline-documentation-standards/javascript/#line-wrapping
  2. https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#formatting-guidelines ("Line wrapping" section)

Why is this a problem?

Docblocks in PHP and JavaScript files have line lengths of varying width. There is little consistency.

Suggested Fix

Let's set the recommended line length limit to 120 characters in all cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions