Skip to content

[feat] order complexity report by combined limit excess#13

Merged
b4prog merged 1 commit into
mainfrom
report-complexity-order
Jun 29, 2026
Merged

[feat] order complexity report by combined limit excess#13
b4prog merged 1 commit into
mainfrom
report-complexity-order

Conversation

@b4prog

@b4prog b4prog commented Jun 29, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Bug Fixes
    • Improved the ordering of reported complex functions so results now sort more consistently based on overall complexity and source location.
    • This makes the most problematic functions appear more predictably at the top of the list.
  • Chores
    • Bumped the crate version to 0.7.6.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 33db7032-d00f-48aa-ba1b-036430d331b5

📥 Commits

Reviewing files that changed from the base of the PR and between 3a32e51 and 3cd840b.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • Cargo.toml
  • src/report/complexity_detection.rs
📜 Recent review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Build, test, and format
🔇 Additional comments (2)
src/report/complexity_detection.rs (1)

35-42: LGTM!

Also applies to: 124-158, 246-278

Cargo.toml (1)

3-3: LGTM!


📝 Walkthrough

Walkthrough

The detect_complex_functions sort is updated to use a new comparator that ranks functions by combined cognitive and cyclomatic complexity excess above their configured limits (clamped at 0), with tie-breaking by file path, start/end line, and function name. Tests cover the new ordering. The crate version is bumped to 0.7.6.

Complexity Excess Sorting

Layer / File(s) Summary
Excess-based comparator and sort wiring
src/report/complexity_detection.rs
detect_complex_functions passes max_cognitive_complexity and max_cyclomatic_complexity into a new comparator that computes combined excess scores (floored at 0) and breaks ties by formatted file path, start line, end line, and function name. Tests assert ordering across higher-excess, tied, and single-dimension cases.
Crate version bump
Cargo.toml
Package version updated from 0.7.5 to 0.7.6.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • b4prog/CodeM8#10: Modifies the same detect_complex_functions sorting logic in src/report/complexity_detection.rs, which this PR directly extends with the excess-score comparator.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: ordering complexity reports by combined limit excess.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch report-complexity-order

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@b4prog b4prog merged commit e78d23f into main Jun 29, 2026
3 checks passed
@b4prog b4prog deleted the report-complexity-order branch June 29, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant