refactor(planner): extract helpers from plan() to reduce complexity (S3776) #76
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "Claude/backup-script:fix/issue-26-S3776-planner-complexity"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #26
Planner.planhad cognitive complexity 16 (SonarQube ceiling: 15).Refactor
Pulled the first two preamble sections out of
plan()into named helpers:_discover_compose_couplings()— runscompose_disco.discover(whenenabled) and returns
(compose_result, coupled_www_paths)so the caller nolonger needs to track the
Nonecase + a separatefor stack in compose_result.stacksloop._add_etckeeper_preflight(plan)— owns theetc.enabled/etckeeper_installed/commit/pushladder that produced the deepestnesting in
plan(). Early-returns instead of nesting.plan()now reads top-to-bottom as four numbered steps and contains a singleloop (the destination x category walk). Same Plan output, same log event,
same step ordering.
Behavior
Identical.
Verification
pytest -q tests/unit/— passes (golden planner tests included)mypy --strict src/gardien/core src/gardien/config src/gardien/engine src/gardien/steps— passesView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.