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
scaffold-project.py and adopt-project.py: three functions ran past Sonar's cognitive-complexity limit, so each is split into the phases its own comments already name #138
SonarCloud's python:S3776 (cognitive complexity ≤ 15) is open on three
functions in the two repository-CREATING tools. They are the last two files of
the S3776 sweep that nobody else is touching.
What is wrong
file:line
function
cognitive complexity
scaffold-project.py:393
_scaffold
85
adopt-project.py:571
cmd_plan
17
adopt-project.py:1195
cmd_execute
24
Queried from the authority rather than guessed:
curl -s 'https://sonarcloud.io/api/issues/search?componentKeys=opensoft_openRepoShape&rules=python:S3776&statuses=OPEN&ps=100'
opensoft_openRepoShape:scaffold-project.py 393 Refactor this function to reduce its Cognitive Complexity from 85 to the 15 allowed.
opensoft_openRepoShape:adopt-project.py 571 Refactor this function to reduce its Cognitive Complexity from 17 to the 15 allowed.
opensoft_openRepoShape:adopt-project.py 1195 Refactor this function to reduce its Cognitive Complexity from 24 to the 15 allowed.
_scaffold is the largest single function in this repository: 386 lines that
run the preflight, the three-name naming check, the --pin descent
declaration, --family detection, --reuse-empty-repo, the plan print, the
three repository creations, the two seed pushes, the assembly root, the topics
and the next-steps block, all in one body. Both cmd_plan and cmd_execute
carry their own argument validation, their own remote arithmetic and their own
report printing inline. All three already wear a # noqa: C901 or are long
past the point where a reader can hold the whole control flow at once, which is
exactly what the rule measures.
What would fix it
Split each of the three by the PHASES the code already has (adopt-project.py
labels them (a), (b), (c), (d) in comments and already keeps _create_leg_remotes, _extract_leg, _seed_leg, _mount_the_legs, _template_values, _split_message and _verify as module-level private
helpers), moving code into more helpers of exactly that shape. No message
text, no exit code, no output order, no gh/git call order and no exception
type changes: this is a move, not a fix.
Behaviour is held byte-identical by the suite that already drives both tools
end to end into BARE repositories in a temporary directory with no network — tests/test_scaffold_e2e.py, tests/test_scaffold_pin_and_reuse.py, tests/test_setup_project_py.py, tests/test_setup_sh.py, tests/test_adopt_plan.py, tests/test_adopt_execute*.py — plus tests/test_cli_reference.py, since neither tool's --help text may move.
(lane openreposhape-2 (openRepoShape-2), 2026-09-12T03:37Z) CLAIMED — session 9c6378ea, on Brett Heap's word 'go, fan out on all of it'. Branch refactor/scaffold-adopt-cognitive-complexity, worktree ~/projects/openRepoShape--s3776-scaffold-adopt on Eagle, from origin/main d682127. Scope: scaffold-project.py_scaffold (cc 85) and adopt-project.pycmd_plan (cc 17) and cmd_execute (cc 24) split into phase helpers, behaviour byte-identical; no other file touched.
(lane openreposhape-2 (openRepoShape-2), 2026-09-12T15:22:00Z) MERGED — #144 → fd1b3f9 (squash), on Brett Heap's word 'go, fan out on all of it, hold the doctor refactor'. scaffold-project.py's _scaffold (Sonar 85, the largest function in the repository) and adopt-project.py's cmd_plan and cmd_execute (17 and 24) now read 7, 2 and 8 — split by the phases their own section comments already marked into module-level private helpers in adopt-project.py's existing style; the plan text, every refusal, the human prompt, and the order of every gh and git call byte-identical; the noqa C901 markers gone with their reason; no pinned copy; PR-scoped Sonar 0 after one S1172 taken; Copilot approved twice, 0 comments; 1136 passed / 1 skipped. Object complete.
Activity
brettheap commentedon Sep 12, 2026
(lane openreposhape-2 (openRepoShape-2), 2026-09-12T03:37Z) CLAIMED — session 9c6378ea, on Brett Heap's word 'go, fan out on all of it'. Branch refactor/scaffold-adopt-cognitive-complexity, worktree ~/projects/openRepoShape--s3776-scaffold-adopt on Eagle, from origin/main d682127. Scope:
scaffold-project.py_scaffold(cc 85) andadopt-project.pycmd_plan(cc 17) andcmd_execute(cc 24) split into phase helpers, behaviour byte-identical; no other file touched.adopt-project.py: `cmd_plan` and `cmd_execute` kept their argument ch…
brettheap commentedon Sep 12, 2026
(lane openreposhape-2 (openRepoShape-2), 2026-09-12T14:45Z) PULL REQUEST OPEN: #144 (head 1abd014).
scaffold-project.py: `_create_remotes` took a `names` it never read, …
scaffold-project.py and adopt-project.py: three functions ran past So…
brettheap commentedon Sep 12, 2026
(lane openreposhape-2 (openRepoShape-2), 2026-09-12T15:22:00Z) MERGED — #144 → fd1b3f9 (squash), on Brett Heap's word 'go, fan out on all of it, hold the doctor refactor'. scaffold-project.py's _scaffold (Sonar 85, the largest function in the repository) and adopt-project.py's cmd_plan and cmd_execute (17 and 24) now read 7, 2 and 8 — split by the phases their own section comments already marked into module-level private helpers in adopt-project.py's existing style; the plan text, every refusal, the human prompt, and the order of every gh and git call byte-identical; the noqa C901 markers gone with their reason; no pinned copy; PR-scoped Sonar 0 after one S1172 taken; Copilot approved twice, 0 comments; 1136 passed / 1 skipped. Object complete.