Repository navigation
[Core] Lower the cognitive complexity of the coverage gate - #13
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SonarQube Cloud reports
python:S3776onmain()incore/.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_hitsmerges the reports.overall_coveragecomputes coverage over the tracked production files.new_code_coveragereports on the changed files.main()now only wires them together.Verification
python3 tools/template-check.py: PASS.Rollout
After the merge, the repositories already on the template pick this up with an
adopt-templaterefresh.