Skip to content

feat: implement issue #34 — SonarCloud: cognitive complexity (S3776) - #38

Closed
don-petry wants to merge 1 commit into
mainfrom
dev-lead/issue-34-20260707-1917
Closed

feat: implement issue #34 — SonarCloud: cognitive complexity (S3776)#38
don-petry wants to merge 1 commit into
mainfrom
dev-lead/issue-34-20260707-1917

Conversation

@don-petry

Copy link
Copy Markdown
Contributor

Closes #34

Implemented by dev-lead agent. Please review.

Copilot AI review requested due to automatic review settings July 7, 2026 19:25
@don-petry
don-petry requested a review from a team as a code owner July 7, 2026 19:25
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@don-petry, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 52 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 94bf8aa3-ac25-419f-ab0f-a6105f0a52c4

📥 Commits

Reviewing files that changed from the base of the PR and between 94fd8a9 and a227e26.

📒 Files selected for processing (5)
  • scripts/discover.py
  • scripts/extract_all.py
  • scripts/flatten.py
  • tests/conftest.py
  • tests/test_refactor.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-lead/issue-34-20260707-1917

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.

@sonarqubecloud

sonarqubecloud Bot commented Jul 7, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — review-changes (no-changes)

No changes were needed for this PR.

@don-petry
don-petry enabled auto-merge (squash) July 7, 2026 19:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the three CLI extraction scripts flagged by SonarCloud rule python:S3776 by extracting pure helper functions, and adds offline unit tests to lock in helper behavior in CI (without requiring a BroodMinder API key).

Changes:

  • scripts/discover.py: extract sample-id discovery and “probe one endpoint” logic into helpers to keep main() flatter.
  • scripts/extract_all.py: split parsing, hive selection, window processing, and budget/early-exit logic into helpers; replace StopIteration-based unwinding with a dedicated exception.
  • scripts/flatten.py: split the two-pass flattening pipeline into helpers (metric-key discovery, deduped streaming, notes flattening, coverage summarization) and add unit tests for the pure parts; adjust pytest skipping so only the live contract test module is skipped without an API key.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_refactor.py Adds offline unit tests covering newly extracted pure helpers used by the refactored scripts.
tests/conftest.py Changes CI behavior to skip only the live contract test module when BROODMINDER_API_KEY is missing.
scripts/flatten.py Extracts helper functions for metric discovery, row building, deduped streaming, note writing, and coverage output.
scripts/extract_all.py Refactors main() into helper functions for argument parsing, hive selection, per-hive processing, and early-exit/budget handling.
scripts/discover.py Extracts helper functions to find sample IDs and to probe endpoints with shared error handling/printing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_refactor.py
Comment on lines +11 to +13
import sys
from datetime import datetime, timezone
from pathlib import Path
@don-petry

Copy link
Copy Markdown
Contributor Author

Closing as duplicate. Issue #34 (cognitive complexity S3776, 3 findings) duplicates #22 (same rule, same 3 findings) — both auto-generated by successive SonarCloud audit runs (the dated-digest accumulation antipattern). PR #26 already covers this workstream for #22. Deduping to #22.

@don-petry don-petry closed this Jul 15, 2026
auto-merge was automatically disabled July 15, 2026 02:36

Pull request was closed

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.

SonarCloud: cognitive complexity (S3776)

3 participants