Skip to content

Extend the Sentence-Length Check to Comments and Docstrings - #2836

Merged
ptr727 merged 5 commits into
developfrom
feature/prose-lint-comment-sentence-length
Oct 11, 2026
Merged

ptr727 merged 5 commits into
developfrom
feature/prose-lint-comment-sentence-length

Conversation

@ptr727

@ptr727 ptr727 commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Closes #2430

The opt-in sentence-length check read only Markdown, so an over-cap sentence in a shell, Python, or workflow comment passed locally and in CI. The counting core is now one helper shared by the Markdown reader, a comment reader, and a Python docstring reader. The comment reader reuses comment_wrap_findings' prose filters. The check stays opt-in and the Markdown behavior is unchanged.

Local strict review ran two rounds. Known remaining gaps, left unfixed past the edit budget:

  • introduced: an indented table under a colon line in a non-Python comment is read as prose, since comment extraction strips the indent.
  • introduced: NumPy-style docstring sections are joined into one sentence.
  • introduced: a docstring whose closing quotes sit on its last code line misses the code-block indent base.
  • introduced: Google-style Args: bodies are treated as code, so a long sentence there is not checked.
  • Pre-existing: TestDiffScopeFloor.test_a_deliberately_narrowed_scan_is_not_told_the_narrowing_is_a_defect fails on develop in this environment too.

🤖 Generated with Claude Code

ptr727 and others added 3 commits October 11, 2026 12:33
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Share the comment filters with the wrap check, split bullets and fields,
treat a colon-led indented block as code, separate adjacent docstrings,
expand tabs, and mask double-backtick spans.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A capitalized comment line starts a new sentence as comment-wrap reads it,
a Sphinx field line starts a field, and implicit string concatenation inside
a docstring no longer reads as two adjacent docstrings.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings October 11, 2026 19:46
@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5f113e88-6be7-4a2a-af00-1cb2319c1c13

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.26%. Comparing base (4035555) to head (9c69479).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2836   +/-   ##
========================================
  Coverage    60.26%   60.26%           
========================================
  Files           16       16           
  Lines         8489     8489           
========================================
  Hits          5116     5116           
  Misses        3373     3373           
Flag Coverage Δ
python-3.13 60.26% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Moderate issues remain in comment table handling and list-marker word counting.

2 open findings
What changed in this PR

Extends the opt-in sentence-length check from Markdown to source comments and Python docstrings.

Changes:

  • Adds shared sentence-counting logic.
  • Adds comment and docstring parsing tests.
  • Updates canonical and generated documentation.
File Description
tests/​test_prose_lint.py Adds coverage for comment and docstring behavior.
.github/​skills/​comment-and-doc-style/​SKILL.md Updates generated documentation.
.github/​actions/​prose-gate/​prose_lint.py Implements comment and docstring scanning.
.claude-plugin/​fleet-skills/​skills/​comment-and-doc-style/​SKILL.md Updates generated plugin documentation.
.claude-plugin/​fleet-skills/​.source-digests/​comment-and-doc-style Refreshes the source digest.
.agents/​skills/​comment-and-doc-style/​SKILL.md Updates canonical documentation.

🧠 Review effort: Lite


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/actions/prose-gate/prose_lint.py Outdated
Comment thread .github/actions/prose-gate/prose_lint.py Outdated
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Three moderate bugs remain in structural-marker handling and incomplete Python parsing coverage.

0 open findings

2 resolved since last review
Previously missed (2)

In code that hasn't changed since last review

Medium severity Normalize numbered comment markers before word counting

.github/​actions/​prose-gate/​prose_lint.py:2702

Bug: numbered comment markers are counted as words here. # 1) <25 prose words>. therefore becomes 26 words and is reported, even though comment_wrap_findings already strips ENUM_PREFIX before judging the same comment. Normalize the body before appending it to keep the sentence-length reader consistent and avoid a false positive at the cap.

Medium severity Include sentence-length in parsed rules for docstring coverage

.github/​actions/​prose-gate/​prose_lint.py:2850

Bug: this new docstring path depends on python_tree(), but sentence-length is not included in PARSED_RULES. When a Python file is invalid or uses syntax this interpreter cannot parse, python_docstring_spans() returns no spans and the docstring prose is silently skipped, with no unparsed warning. Include this rule in the parsed-rule set and add a regression test for the incomplete-coverage path.

🧠 Review effort: Lite

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@ptr727

ptr727 commented Oct 11, 2026

Copy link
Copy Markdown
Owner Author

Both previously-missed findings (numbered comment markers counted as words, and sentence-length missing from PARSED_RULES) were real and are fixed in 9c69479, each with a test that fails without the fix.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Two unresolved moderate findings remain in the sentence-analysis implementation.

0 open findings

Previously missed (1)

In code that hasn't changed since last review

Medium severity Do not infer docstring boundaries from quote characters in content

.github/​actions/​prose-gate/​prose_lint.py:2733

Bug: this heuristic treats a quote at the start of a column-zero docstring content line as an adjacent docstring opener. A module docstring can legally contain lines such as word ... " followed by " word ...; the groups split at this point, so the 26-word sentence is measured as two fragments and passes. Track actual AST string boundaries (or require the delimiter to be the node's opener) instead of inferring a new docstring from quote characters in the text.

🧠 Review effort: Lite

@ptr727

ptr727 commented Oct 11, 2026

Copy link
Copy Markdown
Owner Author

Previously-missed finding on quote-inferred docstring boundaries is real but a rare false negative (a module docstring with a column-zero quote-opening line right after a quote-ending line). Filed under #2838 rather than fixed here, since the correct fix changes python_docstring_spans.

@ptr727
ptr727 merged commit 8729928 into develop Oct 11, 2026
14 checks passed
@ptr727
ptr727 deleted the feature/prose-lint-comment-sentence-length branch October 11, 2026 20:11
ptr727 added a commit that referenced this pull request Oct 11, 2026
…ted Wait Hold to Main (#2840)

## Summary

Promotes [#2836](#2836)
and [#2837](#2837) to
main.

- `prose_lint.py`'s opt-in `sentence-length` check now reads code
comments outside Markdown and Python docstrings, scoped to changed lines
the way Markdown already was. The `comment-and-doc-style` Skill names
the wider scope.
- `pr_review.py wait` holds an attested head on a BLOCKED merge while a
check the base branch's rules require has not registered. An unreadable
rules read keeps the old behavior and says so. `attest` waits up to 60
seconds for a push GitHub has not registered yet, only where the remote
branch already holds the checkout's commit.

Follow-ups filed: #2838 (sentence-length gaps past the edit budget) and
#2839 (required-check matching ignores the rule's `integration_id`).

Closes #2430
Closes #2750

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants