Skip to content

A trailing noqa or pylint directive exempts the prose in front of it from every comment rule #2807

Closed

Description

@ptr727

NOT_PROSE in .github/actions/prose-gate/prose_lint.py exempts a comment body carrying a trailing # noqa or # pylint: directive as a whole, so the prose in front of the directive is judged by none of comment-wrap, comment-case and comment-added.

Constructed case, drawing no finding from any of the three rules:

# A new prose comment the reviewer never sees.  # noqa

On a line holding only a comment, the directive can suppress nothing but findings about the comment itself, so the reason comment-added exempts a directive, that deleting one changes what the file does, does not reach the prose. Appending a directive therefore still switches every comment rule off for that line, a narrower form of #1659.

Judging the body with the trailing directive stripped off would keep the directive exempt and the prose judged. The behavior predates the branch fixing #1659, which narrowed the trailing set to the forms flake8, ruff and pylint read without changing how much of the body it exempts. Found by a local review pass on that branch.

Activity

  1. added
    bugSomething isn't working
    gateA rule with no mechanical check, or a check that misses a shape
    pre-existingReview finding classed pre-existing per local-strict-review Disposing of Findings
    on Oct 11, 2026
  2. ptr727 commented on Oct 11, 2026

    @ptr727
    OwnerAuthor

    A wider shape of the same root, found by a local review pass on #2808: the trailing alternatives in NOT_PROSE (#\s*(?:noqa|type:\s*ignore)\b and \bpylint:) apply in every language, though only Python checkers read those forms. So a TOML, YAML, or shell comment that mentions one mid-sentence is exempt from all three comment rules.

    Constructed case, drawing no finding in a.toml:

    # two sentences here. Each line carries a `# noqa` marker.
    

    The same line without the backticked mention draws comment-wrap, comment-case, and comment-added. Gating the trailing alternatives on the Python path would close this half alongside the one above.

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

    bugSomething isn't workinggateA rule with no mechanical check, or a check that misses a shapepre-existingReview finding classed pre-existing per local-strict-review Disposing of Findings

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions