pgsty / pgsty/farrow

Split the six cognitive-complexity hotspots into options → operation → renderer

Open
#12 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

refactor
Dominant language
Go
Stars
1
Forks
0
Avg merge
3d 12h
Merged PRs (30d)
1

Description

Why

Measured cognitive complexity: runNetwork 157, Config.Validate 112, runImage 110, runSetupCommand 100, Manager.Up 97, runPrivateCommand 92. The CLI handlers mix argument checks, host probing, and three output formats in one body, which is why every review finds another bypass of the error layer.

Proposed shape

  • Per CLI handler: typed options (mostly present) → one domain call returning a typed result → one renderer per format.
  • runNetwork: separate install / uninstall / status handlers, per OS.
  • Manager.Up: extract the existing-state branch (diff, phase classification, the startExisting decision) into a named function shared with Reload.
  • Config.Validate remains one validator; factor the repeated node loops but do not split it to chase a number.

Acceptance

  • No function above roughly 40; behaviour and exit codes unchanged with the existing tests as the oracle; one extraction per commit.
  • Best done after #6 so each renderer has a typed result to consume.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start after issue #6, then read the existing handlers and the Manager.Up/Reload and Config.Validate entry points. Run the existing tests first and use them as the behavior and exit-code oracle while making one extraction per commit. Done means the proposed options → domain result → renderer structure is in place, functions stay roughly under 40 lines, and behavior is unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, linux, macos
Domain
cli, operating-systems
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.