You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
templates/assembly-root/scripts/{validate-pins.py,validate-manifest.py,bootstrap.py}: eight functions exceed Sonar's cognitive-complexity cap of 15 (python:S3776) #132
What is wrong. Eight functions across the three digest-pinned scripts in templates/assembly-root/scripts/ exceed SonarCloud's python:S3776
cognitive-complexity cap of 15 (every branch, loop and boolean-sequence break
adds 1, plus nesting). Line numbers are at main (d682127); complexipy <file> -mx 15 (implements the same SonarSource spec) confirms all eight
locally:
file
function
line
complexipy cc
validate-pins.py
_check_leg
116
28
validate-pins.py
_check_shape_pin
239
17
validate-pins.py
_check_neutral_product_pins
332
32
validate-pins.py
main
444
19
validate-manifest.py
_naming_findings
119
33
validate-manifest.py
_findings
240
71
bootstrap.py
read_authority
228
27
bootstrap.py
main
280
30
(complexipy's own count differs slightly from Sonar's — e.g. it reads 19 for validate-pins.py::main where Sonar's PR analysis is expected to read close
to 17 — because the two implementations round a few constructs differently;
both agree the functions are well over the cap, and SonarCloud's own
per-PR analysis is the authority this is fixed against, not the local number.)
All three files are digest-pinned copies shipped into every scaffolded
project (contracts/shape-pin.yaml's files: rows) — Python 3.9-safe,
dependency-free (they import only the stdlib and the sibling repo_shape.py)
— and tests/test_pin_validator.py, tests/test_neutral_pin_validator.py, tests/test_manifest_validator.py and the bootstrap cases in tests/test_scaffold_e2e.py assert every message, exit code and (for
bootstrap) the exact git state and stdout ordering these functions produce.
What would fix it. Split each flagged function into helpers that each
answer one question — an early return / guard clause where the branching is a
ladder, a per-field or per-kind helper table where it is a dispatch over a
closed set — with no change to any message text, exit code, output order, file
written or exception type. This is a restructuring pass only: python:S3776
was held pending Brett Heap's word and is now lifted ("lets fix the 35 sonar
issues", 2026-09-12T02:1xZ). scripts/repo_shape.py, which all three import,
is a different cluster's file and is not touched here.
(lane openreposhape-2 (openRepoShape-2), 2026-09-12T03:09Z) CLAIMED — session 983ba16a, on Brett Heap's word 'lets fix the 35 sonar issues' (2026-09-12T02:1xZ). Branch refactor/assembly-template-scripts-cognitive-complexity, worktree ~/projects/openRepoShape--s3776-assembly-template on Eagle, from origin/main d682127. Scope: split the eight cognitive-complexity-15+ functions in templates/assembly-root/scripts/{validate-pins.py,validate-manifest.py,bootstrap.py} into helpers, behaviour byte-identical.
(lane openreposhape-2 (openRepoShape-2), 2026-09-12T15:13:31Z) MERGED — #140 → 6e9ae93 (squash), on Brett Heap's word 'go, fan out on all of it, hold the doctor refactor'. templates/assembly-root/scripts: the eight functions Sonar flagged across validate-pins.py (28/17/32/19 → 2/4/2/2), validate-manifest.py (38/69 → 5/4, plus _naming_referent_declared_findings 20 → 0 that the PR's own Sonar analysis caught) and bootstrap.py (27/30 → 7/8) each hand their decisions to named helpers, highest remaining 13; every finding text, print order, exit code and git command sequence byte-identical; all three files are digest-pinned copies so every project reads them upstream-changed until the owed re-pin; PR-scoped Sonar total 0; Copilot approved twice with 0 findings; 1136 passed / 1 skipped. Object complete.
Activity
brettheap commentedon Sep 12, 2026
(lane openreposhape-2 (openRepoShape-2), 2026-09-12T03:09Z) CLAIMED — session 983ba16a, on Brett Heap's word 'lets fix the 35 sonar issues' (2026-09-12T02:1xZ). Branch refactor/assembly-template-scripts-cognitive-complexity, worktree ~/projects/openRepoShape--s3776-assembly-template on Eagle, from origin/main d682127. Scope: split the eight cognitive-complexity-15+ functions in templates/assembly-root/scripts/{validate-pins.py,validate-manifest.py,bootstrap.py} into helpers, behaviour byte-identical.
templates/assembly-root/scripts/validate-pins.py: split _check_shape_…
templates/assembly-root/scripts/validate-pins.py: split _check_neutra…
templates/assembly-root/scripts/validate-pins.py: split main's argume…
templates/assembly-root/scripts/validate-manifest.py: split _naming_f…
templates/assembly-root/scripts/validate-manifest.py: split _findings…
templates/assembly-root/scripts/bootstrap.py: split read_authority's …
templates/assembly-root/scripts/bootstrap.py: split main's setup, ste…
brettheap commentedon Sep 12, 2026
(lane openreposhape-2 (openRepoShape-2), 2026-09-12T14:41Z) PULL REQUEST OPEN: #140 (head f8d834e).
templates/assembly-root/scripts/validate-manifest.py: split _naming_r…
templates/assembly-root/scripts/{validate-pins,validate-manifest,boot…
brettheap commentedon Sep 12, 2026
(lane openreposhape-2 (openRepoShape-2), 2026-09-12T15:13:31Z) MERGED — #140 → 6e9ae93 (squash), on Brett Heap's word 'go, fan out on all of it, hold the doctor refactor'. templates/assembly-root/scripts: the eight functions Sonar flagged across validate-pins.py (28/17/32/19 → 2/4/2/2), validate-manifest.py (38/69 → 5/4, plus _naming_referent_declared_findings 20 → 0 that the PR's own Sonar analysis caught) and bootstrap.py (27/30 → 7/8) each hand their decisions to named helpers, highest remaining 13; every finding text, print order, exit code and git command sequence byte-identical; all three files are digest-pinned copies so every project reads them upstream-changed until the owed re-pin; PR-scoped Sonar total 0; Copilot approved twice with 0 findings; 1136 passed / 1 skipped. Object complete.