Skip to content

Treat a Tool Directive Line as No Previous Sentence in the Comment Wrap Rule #2885

Closed

Description

@ptr727

comment-wrap reports a tool directive as a sentence that wraps into the next comment line. #2828 (#2878) took TOOL_DIRECTIVE names out of comment-case, but comment_wrap_findings still keeps the directive line as the previous body, so the line after it reads as that sentence's continuation.

Constructed case, a .py file checked with --check comment-wrap --check comment-case on develop at 088afab:

# nosec B404
# the next call is checked below.
x = 1
tool.py:1: comment-wrap: comment sentence wraps into the next line -> one sentence per line

The directive is not a sentence, so it cannot wrap. A directive placed directly above an ordinary lower-case comment has no spelling that passes, which is the same trap #2828 closed for comment-case.

Fix shape: a line is_tool_directive matches does not become the previous body in comment_wrap_findings, with a test that fails when the fix is reverted. Found by the #2828 lane, which confirmed the base behaves the same.

Activity

  1. added
    bug
    gate
    pre-existing
    on Oct 12, 2026
  2. added a commit that references this issue on Oct 12, 2026
    7930a22
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

    buggatepre-existing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions