feat: implement issue #22 — SonarCloud: reduce cognitive complexity (S3776, CRITICAL) (×3) - #26
feat: implement issue #22 — SonarCloud: reduce cognitive complexity (S3776, CRITICAL) (×3)#26don-petry wants to merge 3 commits into
Conversation
…S3776, CRITICAL) (×3)
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
Next review available in: 55 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: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (5)
✨ 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.
Pull request overview
Refactors the previously SonarCloud-flagged CLI script main() functions (S3776 cognitive complexity) by extracting smaller pure helpers, while adding unit tests to lock in helper behavior and adjusting pytest collection so unit tests always run without requiring a live API key.
Changes:
- Extracted helper functions in
scripts/discover.py,scripts/extract_all.py, andscripts/flatten.pyto reduce cognitive complexity while preserving behavior. - Added new unit tests for extracted “pure” helpers (no network / no API key required).
- Updated pytest collection behavior so only the live contract test module is skipped when
BROODMINDER_API_KEYis not set.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_scripts.py | Adds unit tests for extracted pure helpers (discover/flatten) to lock in behavior offline. |
| tests/conftest.py | Changes skip logic so only live contract tests are skipped when no API key is present. |
| scripts/flatten.py | Extracts metric discovery, row-building, per-hive flattening, and output writers to simplify main(). |
| scripts/extract_all.py | Extracts argument parsing, hive selection, per-window processing, and per-hive extraction loop helpers. |
| scripts/discover.py | Extracts sample-id discovery and endpoint sampling into helpers to flatten main(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Remove unused `bm` parameter from `_sample_endpoint` (S1172) and replace bare float equality assertions with `pytest.approx` (S1244). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Dev-Lead — review-changes (applied)Changes committed and pushed. |
|
|
Note @don-petry I reviewed this PR and no code changes were needed, but it still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews), so I cannot mark it done yet. I'll re-check automatically. |
Dev-Lead — waiting on PR blockers (intent: review-changes)PR: #26 |
Dev-Lead Fix CI — appliedPR: #26 | SHA: |
|
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
|
Closing this conflicted (DIRTY) PR — main has evolved since it was generated (2026-07-03/07), so a hand-merge would drag stale code over main's newer version. Driving issue #22 keeps its |
Pull request was closed





Closes #22
Implemented by dev-lead agent. Please review.