superfly / flyctl

Function with cyclomatic complexity higher than threshold GO-R1005
Anti-pattern
Minor
3 days ago8 months old
func runMachineClone has a cyclomatic complexity of 41 with "very-high" risk
 83	return cmd
 84}
 85
 86func runMachineClone(ctx context.Context) (err error) { 87	var (
 88		out      = iostreams.FromContext(ctx).Out
 89		appName  = appconfig.NameFromContext(ctx)
func ToTestMachineConfig has a cyclomatic complexity of 16 with "high" risk
 91	}
 92}
 93
 94func (c *Config) ToTestMachineConfig(svc *ServiceMachineCheck, origMachine *fly.Machine) (*fly.MachineConfig, error) { 95	var machineEntrypoint []string
 96	if svc.Entrypoint != nil {
 97		machineEntrypoint = svc.Entrypoint
func updateMachineConfig has a cyclomatic complexity of 21 with "high" risk
217}
218
219// updateMachineConfig applies configuration options from the optional MachineConfig passed in, then the base config, into a new MachineConfig
220func (c *Config) updateMachineConfig(src *fly.MachineConfig) (*fly.MachineConfig, error) {221	// For flattened app configs there is only one proces name and it is the group it was flattened for
222	processGroup := c.DefaultProcessName()
223
func warnAboutIncorrectListenAddress has a cyclomatic complexity of 18 with "high" risk
 949	fmt.Fprint(md.io.Out, "\n")
 950}
 951
 952func (md *machineDeployment) warnAboutIncorrectListenAddress(ctx context.Context, lm machine.LeasableMachine) { 953	group := lm.Machine().ProcessGroup()
 954
 955	if _, seen := md.listenAddressChecked.LoadOrStore(group, struct{}{}); seen {
func deployToMachines has a cyclomatic complexity of 19 with "high" risk
339}
340
341// in a rare twist, the guest param takes precedence over CLI flags!
342func deployToMachines(343	ctx context.Context,
344	cfg *appconfig.Config,
345	app *fly.AppCompact,