refactor(cli): extract plan formatters from cmd_plan (S3776) #66
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "Claude/backup-script:fix/issue-21-S3776-cmd-plan-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 #21
cmd_planmixed config loading, planning, JSON serialization andpretty-printing in one function — cognitive complexity 16, over SonarQube's
15-line ceiling.
Refactor
_plan_to_json_dict(plan)_print_plan_text(plan)After the split,
cmd_planis ~10 lines (complexity ~3), and each helpersits well under the ceiling. Behavior is byte-for-byte identical to master.
Note
plan: Anyannotation on the helpers avoids a top-level import ofgardien.core.planner.Plan— the existingcmd_planbody uses a deferredimport (inside the function) for the same reason. Keeping the helpers
loosely typed preserves the current import shape; if the strict-typing
boundary expands to cover
cli.py, the annotation can be tightened then.Verification
pytest -q tests/unit/— 211 passedruff check src/gardien/cli.py— no new errors (4 pre-existing PTH errors unchanged)View 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.