fix(init): don't read a per-function line count as a per-file cap#61
Conversation
--from-claude-md derived max_lines --max 50 from phrasing like '~50 lines per function, ~800 per file': the file-cap regex let the gap between the number and the file word bridge across the comma and the 800, capturing the function's 50 and then flagging nearly every file. Exclude commas and digits from that gap so a match can't cross a clause boundary; an ambiguous comma-joined guideline now derives no cap instead of a wrong one. Surfaced field-testing becwright against a real Python repo (bot-telegram). Regression test covers the EN and ES phrasings.
|
Warning Review limit reached
Next review available in: 44 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 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 |
What & why
Surfaced while field-testing becwright against real repositories (the last open item on the path to 1.0.0). Running
becwright init --from-claude-mdon a real Python project (bot-telegram) derived amax-file-linesrule of--max 50, which flagged nearly every file in the repo.Root cause: the project's
CLAUDE.mdsaid, as soft guidance, "~50 líneas por función, ~800 por archivo" ("~50 lines per function, ~800 per file"). The file-cap regex's gap between the number and the file word ([^.\n]{0,25}?) was permissive enough to bridge across the comma and the800, so it captured the function's 50 and turned it into a per-file cap.Fix
Exclude commas and digits from that gap (
[^.,\n\d]) in both alternatives of_FILE_LINE_CAP, so a match can't cross a clause boundary. For this comma-joined, elliptical phrasing the file number (800) has nolinesword of its own, so becwright now derives no cap rather than a wrong one — the conservative, correct outcome for an ambiguous soft guideline (the derivation already leaves judgment calls toCLAUDE.md).Unchanged, still-passing cases: "files under 800 lines", "Máximo 300 líneas por archivo", "800 lines per file", function-only phrasings (→ none), out-of-range caps (→ none).
Field test results (this closes the "validate on real repos" item)
check --allread-only, 16 rulesCLAUDE.mdinit --from-claude-mdCLAUDE.mdinit+check --allOriginals were never modified — Python/JS repos were tested in throwaway clones; the TS adopter was
check-only (read-only).Test plan
test_max_lines_cap_does_not_bridge_function_cap_to_file_word).pytest— 252 passing.max 50.