Skip to content

Prose Gate comment-case Rejects Every Config Snippet in a Comment #1700

Closed

Description

@ptr727

Problem

comment-case fires on any comment line whose sentence opens in lowercase. A config snippet inside a comment opens on a lowercase key by definition, so no form of it can pass. This makes the rule and a copy-pasteable snippet mutually exclusive.

The case that surfaced it is the External usage: header every template in ptr727/ESPHome-Config carries:

# External usage:
# packages:
#   device: github://ptr727/ESPHome-Config/templates/<name>.yaml@main

# packages: is exempt via KEY_ONLY. The line below it is not, and it takes both comment-case (opens lowercase) and comment-wrap (the next such line continues it).

Every shape tested, all rejected

Tested against .github/actions/prose-gate/prose_lint.py at main:

Shape Result
# device: github://... comment-case + comment-wrap
single snippet line, no sibling comment-case
# device: github://...@main. (trailing period) comment-case
preceded by a terminated sentence comment-case
# device - github://... (COMMENT_LABEL) comment-wrap only, case exempt
# Device: github://... (capitalized key) passes
# - device: github://... (dash prefix) passes

Only the last two pass, and both damage the snippet. A capitalized key changes what a reader pastes. A dash prefix is not valid YAML for a named packages: mapping, since ESPHome's list form takes bare package refs rather than name: ref.

Why this matters beyond one repo

The rule is diff scoped, so ~30 existing templates carrying this header pass only because their lines are untouched. Any new template, or any edit to an existing header, fails. The rule therefore blocks new content while grandfathering identical old content, and the failure is invisible until someone adds a file.

A fenced block in Markdown is exempt via CODE_FENCE, so the same snippet passes in a .md file and fails in a YAML comment. That asymmetry is the clearest sign this is a gap rather than an intended constraint.

Recommended fix

Exempt a comment line that is a config snippet rather than prose. The narrowest form matching the existing exemption style would sit beside KEY_ONLY: a body matching ^\S+:\s+\S+$, a single key, a colon, and a single value with no sentence punctuation. That admits device: github://... and sda: GPIO17 while still judging real prose that happens to open lowercase.

A wider alternative is a fence marker usable inside a comment block, which would also cover multi-line snippets, at the cost of a new convention authors have to know.

Evidence

Reproduced on ptr727/ESPHome-Config#153, where Copilot independently raised the capitalized keys as a defect against repo convention, giving two rules in direct conflict. The maintainer chose paste fidelity, so that pull request now carries a red comment-case result pending this issue.

Activity

  1. added a commit that references this issue on Sep 20, 2026
    3a5c113
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions