Skip to content

Rule to detect long docstrings (or extra config for W505) #25995

Open

Description

@hugovk

Summary

PEP 8 says:

For flowing long blocks of text with fewer structural restrictions (docstrings or comments), the line length should be limited to 72 characters.

Rule doc-line-too-long (W505) can enforce this when lint.pycodestyle.max-doc-length is set (the rule is ignored when unset).

However, I would like to only detect overlong docstrings. I'm not bothered about long comments.

Would it be possible to add a new rule for just docstrings? I can imagine someone might want it for just comments and not docstrings, so rather than a new rule, perhaps extra config for the existing W505 would be a better fit.

(Re: python/cpython#150285 (comment))

Activity

  1. ntBre commented on Jun 15, 2026

    @ntBre
    Contributor

    It looks like I found a hacky workaround for this in #15733, but it might be worth supporting a more direct solution.

  2. added
    rule
    needs-decision
    on Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-decisionrule

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions