Skip to content

prose_lint sentence-length Misses Sentences Wrapped Across Lines #2292

Closed

Description

@ptr727

Symptom

scripts/prose_lint.py --check sentence-length counts words per physical line. A sentence that a hard-wrapped Markdown file spreads over several lines is never measured whole, so it passes however long it is.

Reproduction (constructed)

Run the check on two files that hold the same 31-word sentence:

oneline.md   the sentence on one line
wrapped.md   the same sentence wrapped after "so that"

prose_lint.py --check sentence-length wrapped.md oneline.md reports only oneline.md:3: sentence-length: 31 words in one sentence, and nothing for wrapped.md.

Impact

Downstream repos carry hard-wrapped Markdown, such as a WORKFLOW.md wrapped at a fixed width. A change there passes the local lint and then draws a reviewer finding for the same rule. In homeassistant-purpleair, this round's WORKFLOW.md matrix bullet had a sentence over 25 words. The linter passed it, Copilot flagged it on the promotion pull request, and it took a separate fix pull request (ptr727/homeassistant-purpleair#368).

Fix

Join each paragraph's lines (and each list item's continuation lines) before splitting into sentences. Report the violation on the line where the sentence starts. comment-wrap already reasons about sentences that span comment lines, so that code may be reusable here.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions