Skip to content

Read a First-Line Comment After a Byte Order Mark as Leading in Every Language #2798

Closed

Description

@ptr727

Problem

A leading UTF-8 byte order mark makes the prose gate read a first-line comment as trailing in every language other than Python. extracted_comments in .github/actions/prose-gate/prose_lint.py judges a comment leading with not line[:at].strip(), and U+FEFF is not whitespace, so the comment is marked trailing. comment-added and issue-ref read leading comments only, so they drop it.

For example, a constructed tool.sh or tool.ps1 holding # See #12 for why. yields no issue-ref finding, while the same text without the mark does. A PowerShell file is the likely carrier, since Windows editors commonly add the mark.

The Python reads drop the mark themselves since the fix for #2163, at three separate sites. Dropping it once where check_file decodes the file would cover every language and could replace those three, provided no rule needs to see the mark itself.

Done

A first-line comment in a file carrying a byte order mark is read as leading in every language the gate reads, with a test per comment syntax that fails without the fix.

Found by the local strict review of the #2163 fix (handoff #2795). The finding is on code that change did not touch.

Activity

  1. added
    bug
    pre-existing
    prose
    on Oct 11, 2026
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

    bugpre-existingprose

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions