refactor(hooks): centralize thresholds and drop dead code#49
Conversation
- Add MIN_DOCUMENT_WORDS, MAX_PARAGRAPH_WORDS, DEFAULT_PUBLISH_THRESHOLD and get_publish_threshold() (reads grades.B.min) to hook_utils.py. - doc_post_review.py: derive the score-only publish threshold from quality-gates.json instead of a hardcoded 80. - doc_post_write.py: use the shared paragraph threshold and remove the dead seen_lines set (line indices are already unique per pass). - doc_pre_write.py: drop the unreachable non-fenced Protocol ellipsis handler (valid examples belong in fenced blocks) and hoist content.lower() out of the forbidden-pattern loop. - smoke.sh: add a regression asserting post-review honors the configured Grade B threshold. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughHardcoded numeric thresholds ( ChangesConfigurable thresholds and shared constants across hooks
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
0562351
into
main
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | -7 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 076e41efa3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
|
|
||
| results["passed"] = extract_bool("passed") | ||
| results["ready_for_publish"] = extract_bool("ready_for_publish") | ||
| publish_threshold = get_publish_threshold(get_project_dir()) |
There was a problem hiding this comment.
Keep promotion suggestions aligned with /doc-promote
When projects customize grades.B.min away from 80, this hook now derives score-only readiness from that value, but the suggested next step still calls /doc-promote, whose rough_draft→pending_approval gate is hard-coded to score ≥80 in .claude/commands/doc/doc-promote.md lines 51 and 104. For example, B.min=75 makes a score-only 75 review emit a promotion suggestion that /doc-promote will block, while B.min=86 suppresses a score 85 suggestion even though /doc-promote would pass it; keep this hook on the same threshold as the promotion command or update both together.
Useful? React with 👍 / 👎.
Summary
Cleanup pass over the documentation hooks — no behavior change at default config.
hook_utils.py: addsMIN_DOCUMENT_WORDS(50),MAX_PARAGRAPH_WORDS(200),DEFAULT_PUBLISH_THRESHOLD(80), andget_publish_threshold()which readsgrades.B.minfromquality-gates.json.doc_post_review.py: score-only publish/readiness derivation now uses the configured Grade B threshold instead of a hardcoded80.doc_post_write.py: uses the shared paragraph threshold; removes the deadseen_linesset (line indices are already unique within each variant pass).doc_pre_write.py: removes the unreachable non-fenced Protocol-ellipsis handler (valid code examples belong inside fenced blocks, which_fenced_code_spans()already allows); hoistscontent.lower()out of the forbidden-pattern loop.Verification
get_publish_threshold(.)→ 80, matchinggrades.B.min(default behavior preserved)..codexhook mirror byte-identical to.claudesources (parity).Tests
grades.B.min=86, score 85 → no promotion)..codexparity + markdownlint).🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
New Features
Improvements