Skip to content

[Core] Lower the cognitive complexity of the coverage gate - #13

Merged
LarsLaskowski merged 1 commit into
mainfrom
claude/coverage-check-complexity
Oct 3, 2026
Merged

LarsLaskowski merged 1 commit into
mainfrom
claude/coverage-check-complexity

Conversation

@LarsLaskowski

@LarsLaskowski LarsLaskowski commented Oct 3, 2026 •

Copy link
Copy Markdown
Owner

Summary

SonarQube Cloud reports python:S3776 on main() in core/.squad/tools/coverage-check.py: its cognitive complexity is 17, and 15 is allowed. The issue shows up in every repository that adopts the template (seen on LarsLaskowski/DockerUpdateGuard#251).

The function is split into three helpers:

  • merged_hits merges the reports.
  • overall_coverage computes coverage over the tracked production files.
  • new_code_coverage reports on the changed files.

main() now only wires them together.

Verification

  • The gate's output is byte-for-byte identical before and after the change, checked on PlexToJellyfinSync.
  • python3 tools/template-check.py: PASS.

Rollout

After the merge, the repositories already on the template pick this up with an adopt-template refresh.

SonarQube Cloud reports python:S3776 on main() in coverage-check.py (cognitive complexity 17, 15
allowed) in every repository that adopts the template. Merging the reports, computing overall coverage
and computing new-code coverage now live in their own functions. The output is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014xZzHGWbMaKfnCWeA4Lgj1
@LarsLaskowski
LarsLaskowski merged commit 9b733d0 into main Oct 3, 2026
4 checks passed
@LarsLaskowski
LarsLaskowski deleted the claude/coverage-check-complexity branch October 3, 2026 13:19
LarsLaskowski added a commit that referenced this pull request Oct 6, 2026
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.

2 participants