Report complexity#10
Conversation
|
Warning Review limit reached
More reviews will be available in 31 minutes and 35 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?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 credits. 🚦 How do rate 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 see our Fair Usage Limits Policy for further information. 📝 WalkthroughWalkthroughAdds a ChangesComplexity Reporting Feature
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/cli/help.rs`:
- Around line 48-49: The help text for the -verbose flag is too broad because
render_complexity_report always shows the complexity metrics, so update the
wording in the help/README to describe only the fields that are actually
verbose-only, such as analyzed files and timings. Adjust the help string in the
CLI help definition and keep any related documentation wording aligned with the
same intent.
In `@src/discovery/explicit.rs`:
- Around line 48-54: In explicit_file_metadata, the symlink_metadata error
handling currently converts every failure into the missing-file message, which
hides real I/O causes. Update the map_err logic to match on the io::ErrorKind:
keep the existing “explicit file does not exist” CodeM8Error for NotFound, and
for all other errors wrap them with CodeM8Error::io so permission and path
failures are preserved.
In `@src/lib.rs`:
- Around line 80-92: Filter `-git-branch` paths before calling
`line::process_source_files` so branch-scoped scans only process changed files
instead of the full discovered set. In `src/lib.rs`, use the existing
`git_branch_files` and `filtered_processed_files` flow earlier in the
`discover_report_files`/`time_result` sequence so `process_source_files`
receives the narrowed file list, while keeping the existing
`duplicate_source_files` handling consistent.
In `@src/report/complexity_detection.rs`:
- Around line 160-179: The detects_functions_over_either_limit test in
complexity_detection.rs only exercises the case where both cognitive and
cyclomatic complexity exceed the threshold, so it does not prove the “either
limit” behavior. Update this test around detect_complex_functions and the risky
function fixture to add asymmetric coverage: one case where only
cognitive_complexity is over the limit and another where only
cyclomatic_complexity is over the limit, while keeping the assertions aligned
with the expected single-match result.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e304bb8f-0cf4-4f03-b69e-7145233a143c
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (14)
Cargo.tomlREADME.mdsrc/cli/args.rssrc/cli/help.rssrc/cli/mod.rssrc/discovery/explicit.rssrc/lib.rssrc/main.rssrc/model.rssrc/report/complexity_detection.rssrc/report/complexity_renderer.rssrc/report/duplicate_detection.rssrc/report/duplicate_renderer.rssrc/report/mod.rs
📜 Review details
🔇 Additional comments (12)
src/report/complexity_detection.rs (2)
13-37: LGTM!Also applies to: 63-123, 149-157
49-50: 🎯 Functional CorrectnessDon't silently treat parser failures as "no issues".
run_complexity_reportinsrc/lib.rs:118-161counts the file as analyzed before detection, so thisOk(Vec::new())path can become a false negative ifrust_code_analysis::get_function_spaces()returnsNonefor invalid or unsupported syntax. Please verify therust-code-analysis0.0.25 contract here and either surface an error or report the file as skipped explicitly.src/report/mod.rs (1)
1-11: LGTM!src/model.rs (1)
45-53: LGTM!src/report/complexity_renderer.rs (1)
8-130: LGTM!Also applies to: 139-208
src/cli/mod.rs (1)
15-32: LGTM!Also applies to: 50-50
Cargo.toml (1)
3-3: LGTM!Also applies to: 17-17
src/cli/args.rs (1)
5-278: LGTM!Also applies to: 281-506
src/cli/help.rs (1)
10-46: LGTM!Also applies to: 51-122
src/main.rs (1)
17-23: LGTM!src/report/duplicate_detection.rs (1)
22-33: LGTM!Also applies to: 50-141, 177-265
src/report/duplicate_renderer.rs (1)
27-125: LGTM!
skip full-repo discovery for branch-scoped complexity reports keep duplicate reports scanning the full repository for comparison
|
@CodeRabbit resume |
✅ Action performedReviews resumed. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/lib.rs`:
- Around line 84-88: `filtered_processed_files(...)` is dropping unchanged files
in `-git-branch` mode, which causes `detect_duplicate_blocks(...)` to miss
repo-wide duplicates. Update the `config.git_branch` branch in `src/lib.rs` so
the `processed_files` set is passed through unchanged instead of returning only
`config.files.as_deref()`, keeping duplicate detection full-repository. Refer to
the `filtered_processed_files` flow and the `detect_duplicate_blocks` call site
to make sure unchanged files remain included when `git_branch` is enabled.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 819ecd08-6b67-4506-aeb1-8c42eb7ab8ce
📒 Files selected for processing (4)
src/cli/help.rssrc/discovery/explicit.rssrc/lib.rssrc/report/complexity_detection.rs
🚧 Files skipped from review as they are similar to previous changes (2)
- src/cli/help.rs
- src/discovery/explicit.rs
📜 Review details
🔇 Additional comments (3)
src/report/complexity_detection.rs (1)
161-208: LGTM!src/lib.rs (2)
128-132: LGTM!Also applies to: 179-179
363-372: LGTM!Also applies to: 418-425, 466-472, 497-509, 641-678
Summary by CodeRabbit
--report-complexitymode with configurable cognitive and cyclomatic complexity thresholds.-filesquoting tips), git-branch workflows, and PowerShell-friendly usage.