Skip to content

Report a Python File the Prose Gate Cannot Parse Instead of Skipping It #2163

Description

@ptr727

Problem

The prose gate's Python checks pass silently when the interpreter running prose_lint.py cannot parse a file that the repository's own interpreter can. .github/actions/prose-gate/prose_lint.py returns {} from its docstring extraction on a SyntaxError (around line 2180), so the docstring checks skip that file, and python_comments returns None (around line 1770), so its caller falls back to regex comment extraction. The gate then reports a pass with less coverage rather than failing.

Every local surface runs the gate on a host interpreter rather than the repository's own: the Husky snippet runs py -3 or python3, and the VS Code "Lint: Prose" task and the pre-commit snippet run uv run --no-project python, which ignores the repository's requires-python. A repository whose requires-python sits above that interpreter, and whose code uses newer syntax, such as a PEP 695 type statement read by Python 3.11, reaches the silent skip. For example, a constructed file holding type Alias = int above a function with a docstring, read by a 3.11 interpreter, gets no docstring check at all.

Done

A Python file the gate cannot parse is reported rather than skipped, or the gate states in its scope line that it skipped the file's AST-based checks, so a pass under a mismatched interpreter is distinguishable from a clean one.

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

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 workingpre-existingReview finding classed pre-existing per local-strict-review Disposing of FindingsproseA defect in rule or procedure text

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions