feat(init): map a file line cap from CLAUDE.md to max_lines#45
Merged
Conversation
--from-claude-md now extracts a per-file line cap (e.g. 'files under 800 lines') and emits a max_lines rule for it. The regex anchors the number to a file/module mention so a 'functions < 50 lines' rule — which needs an AST and becwright cannot enforce — is not mistaken for a file cap; the cap is bounded to 50..5000. Emitted as a warning.
|
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)
📝 WalkthroughWalkthroughThis PR extends ChangesMax-file-lines rule derivation
Estimated code review effort: 2 (Simple) | ~12 minutes Possibly related PRs
✨ 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 |
2 tasks
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.
Why
Follow-up to the three agnostic checks (#44): connect the most common — and
unambiguous — one to
--from-claude-md. "Files under 800 lines" is in mostCLAUDE.md files (becwright's own included), and it's deterministic.
What
--from-claude-mdnow extracts a per-file line cap from the prose and emitsa
max_linesrule:The tricky part is the functions-vs-files trap: a CLAUDE.md often says
"functions < 50 lines, files < 800 lines". The 50 is function length, which needs
an AST and becwright can't enforce. So the regex anchors the number to a
file/module/archivo/módulomention (EN/ES, both orders) and bounds it to50..5000 — "functions must be under 50 lines" maps to nothing, as it should.
Emitted as a
warning(a big file shouldn't hard-block adoption).Scope
filenameandrequireare intentionally not auto-mapped: they're tooparametric/semantic for a keyword table (auto-generating them would ship noisy
repo-wide rules). They stay available for manual authoring and are the natural
job of the agent/MCP layer (see design doc). This keeps the CLI's mapping honest.
Test plan
_max_lines_capextracts the cap (EN/ES, both word orders)_rules_from_claude_mdemits amax_lines --max Nrule (warning)Summary by CodeRabbit
New Features
becwright init --from-claude-mdcan now infer and apply a per-file line limit fromCLAUDE.mdwhen it’s stated in natural language.Documentation
--baseline.Tests