Repository navigation
Conversation
Implements #3634. - **A PEP 723 block is now an instruction to a tool rather than a comment.** The Python language data in `prose-gate.json` declares the block's form in a new `metadata_block` key: its opener, its content-line form, and its closer. `metadata_block_lines` in `prose_lint.py` returns the lines of each closed block in a comment unit. `comment-added` skips those lines. - **`comment-wrap` and `comment-case` skip the same lines.** Before, a block declaring one key reported `comment-wrap` on its opener, and the earlier test recorded that finding as one with "no remedy at all". The `comments` label does not reach that rule, and `uv` parses the block as written, so it cannot be reformatted. A block with a `[tool.uv]` table reported too. The new helper fixes that whole class of defect, so both rules now use it. - **Only a closed block on the declared form is exempt.** A prose line after the closer still reports. So does each line under an opener nothing closes, or under one whose block has a line off the form. The data is per language, so a shell file holding the same text still reports. - `scripts/README.md` states the exemption under `comment-added`. It replaces the run-based account of the PEP 723 opener in the configuration-run paragraph. ## Verification - The `prose_lint` suite passes, with 641 tests run. - In the new `comment-added` test, a block followed by a prose line reports only the prose line. The unclosed, off-form, and non-Python cases each report exactly lines 1 and 2. Against develop's script the block reports lines 1 to 3. - The `one key` and `tool table` subtests report `comment-wrap` against develop and nothing here. - ruff format, ruff check, mypy, the eol gate, the diff-scoped prose gate with `comment-added` live, and a whole-tree prose run are clean. ## Local review Three passes ran at the `frontier` tier, and the last one is recorded at `0eec2d1` with no findings. The first round's `comment-wrap` finding and its loose subtest assertions were fixed in `531d0be`. The second round's stale test docstring was fixed in `0eec2d1`. ## Pre-existing findings, filed - An extensionless script whose shebang is `#!/usr/bin/env -S uv run --script` is read with the `bash` lexer, so it gets none of the Python reading. Filed as #3673, class `pre-existing`. ## Pre-existing findings, not filed - `scripts/README.md:112`: "the exemption reaches six lines in three files" was already undercounted before this change, since every hub script's two-key PEP 723 block was itself a configuration run. Class `pre-existing`. ## Declined findings - `.github/actions/prose-gate/prose_lint.py` `metadata_block_lines`: the review asked whether to share a scanner with `front_matter_end`. That function is anchored at index 0 over raw strings, while the new helper reads `Line` units at any position, so sharing one would mean generalizing the front-matter reader. Class: consolidation. Closes on promotion: #3634 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3675 +/- ##
=======================================
Coverage 81.72% 81.72%
=======================================
Files 27 27
Lines 9128 9128
=======================================
Hits 7460 7460
Misses 1668 1668
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the proposed metadata-block exemption and its covered boundary cases.
No open issues 🎉
What changed in this PR
This pull request promotes the PEP 723 metadata-block exemption from develop to main, preventing valid Python script metadata from being evaluated as prose comments.
Changes:
- Defines Python PEP 723 metadata-block syntax in the prose-gate configuration.
- Excludes closed metadata blocks before comment rules run.
- Adds regression coverage for valid, invalid, unclosed, non-Python, and post-block cases.
- Documents the exemption and its scope.
This pull request requires changes.
| File | Summary |
|---|---|
tests/test_prose_lint.py |
Tests metadata-block handling across comment rules and boundary cases. |
scripts/README.md |
Documents the PEP 723 exemption and its scope. |
.github/actions/prose-gate/prose-gate.json |
Defines the Python metadata-block opener, content form, and closer. |
.github/actions/prose-gate/prose_lint.py |
Removes closed metadata blocks from comment units before rule evaluation. |
Review effort: Lite
…3678) Promotes the changes merged into `develop` since promotion #3675 to `main`. - [#3676](#3676) Reads a `uv run` shebang as Python in the prose gate. A new `files.runner` map in the gate's data names the interpreter a runner runs, so an extensionless `uv run --script` file gets the Python reading, the PEP 723 metadata block exemption among it. Closes #3673 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Promotes the changes merged into
developsince promotion #3667 tomain.# /// scriptblock qualifies.Closes #3634
🤖 Generated with Claude Code