Skip to content

A lower-case tool directive the prose gate exempts from comment-added still draws comment-case #2828

Closed

Description

@ptr727

A tool directive that TOOL_DIRECTIVE exempts from comment-added still draws comment-case in a .py file when the directive opens in lower case and its body carries no key: shape that another exemption reads. TOOL_DIRECTIVE is read by comment-added alone, and the comment above it says so deliberately: "Read by comment-added alone rather than added to NOT_PROSE, which two gating rules share." So comment-case judges these directives as sentences.

Constructed cases, checked with check_file and the three comment rules on the develop head that carries #2827:

# nopep8          in tool.py -> comment-case
# nosec B404      in tool.py -> comment-case
# nopep8: E501    in tool.py -> no finding
x = 1  # nopep8   in tool.py -> no finding (the trailing form is cut)

A tool that reads its directive only in lower case leaves no spelling that passes comment-case, and deleting or rewording the directive changes what the file does. pycodestyle reads nopep8 in any case, so # NOPEP8 passes once #2827 merges, but nosec and hadolint have no such escape that has been verified.

Raised by the Copilot round on #2827 as "nopep8 must also be added to NOT_PROSE to prevent comment-case findings". This is pre-existing behavior rather than something #2827 introduced, since NOT_PROSE never listed nopep8 and the lower-case # nopep8 drew comment-case before that change as well. It applies to every TOOL_DIRECTIVE name, so it is filed as one class rather than fixed for nopep8 alone.

Whether these names should leave comment-case as well, or the narrow exemption should stand with the label as the remedy, turns on the design note above, so the fix is a choice between those two rather than a determined outcome.

Activity

  1. added
    bug
    gate
    pre-existing
    on Oct 11, 2026
  2. ptr727 commented on Oct 12, 2026

    @ptr727
    OwnerAuthor

    Maintainer decision (2026-10-12): TOOL_DIRECTIVE names leave comment-case as well. comment-case reads TOOL_DIRECTIVE itself, and the names are not added to the shared NOT_PROSE.

  3. added a commit that references this issue on Oct 12, 2026
    c50f93f
  4. added 2 commits that reference this issue on Oct 12, 2026
    8fc06c1
    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