Repository navigation
feat(recheck): add word-count, sentence-count, and reading-time formulas to the metric assertion - #3183
Merged
Conversation
…las to the metric assertion
|
Contributor
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
Marshevskyy
approved these changes
Oct 3, 2026
Marshevskyy
approved these changes
Oct 3, 2026
RomanHotsiy
approved these changes
Oct 3, 2026
Contributor
Performance Benchmark (Lower is Faster)
|
JLekawa
approved these changes
Oct 5, 2026
AlbinaBlazhko17
approved these changes
Oct 5, 2026
AlbinaBlazhko17
left a comment
Contributor
There was a problem hiding this comment.
I wanted to clarify: word-count with min never reports a page with no prose (the stats.words === 0 early return, tested in never flags a document with no prose). Is it intended?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What/Why/How?
Ports the size formulas of the recheck
metricassertion from the Redocly monorepo (Redocly/redocly#28017).metricaccepts three new formulas next to the six readability formulas:word-count,sentence-count, andreading-time.reading-timeis minutes at a newwordsPerMinuteoption, default 200, rounded to one decimal before the bounds check so the number in the message is the number that was compared.wordsPerMinutethat is not a positive number, and rejects the option with any formula other thanreading-time.Document %s is %s; expected between %s and %s.; the placeholder order (formula, score, min, max) is unchanged.The engine README documents the formulas and adds a page-size budget example: a word cap on
.claude/skills/**/SKILL.md.Docs conflict with #3182. That PR adds
docs/@v2/recheck/assertions.mdwith themetricoption table. This PR does not touch that page, to avoid an add/add conflict. After #3182 merges, theformularow needs the three size formulas and the table needs awordsPerMinuterow. I can open that follow-up.Reference
Testing
metric.test.tscover the three formulas, the default and customwordsPerMinute, the rounding before comparison, and the new validation cases.npm run compile,npm run typecheck, and the recheck unit suite pass.word-countrule and areading-timerule against a skill file, and confirmed a misplacedwordsPerMinuteis rejected at config load.Screenshots (optional)
Check yourself
Security
🤖 Generated with Claude Code
Note
Low Risk
Additive linting behavior and stricter config validation for metric options; no auth, data, or runtime security surface changes.
Overview
Extends recheck’s
metricassertion with size formulas (word-count,sentence-count,reading-time) alongside the existing readability formulas, so whole-file prose can be bounded by length or estimated reading time—not only readability scores.reading-timeuses optionalwordsPerMinute(default 200), rounded to one decimal before min/max comparison so diagnostics match the verdict. Size metrics reuse the same prose extraction as readability (code, front matter, headings, Markdoc stripped); empty prose is never flagged. Size violations use the fallbackDocument %s is %s; expected between %s and %s.Config validation accepts the new formulas and rejects invalidwordsPerMinuteusage.The package README documents the formulas and adds a
recheck/skill-size-budgetexample (word cap on.claude/skills/**/SKILL.md). Tests cover execution, validation, and README snippet drift.Reviewed by Cursor Bugbot for commit 4fe3552. Bugbot is set up for automated code reviews on this repo. Configure here.