apppackio / apppack

Function with cyclomatic complexity higher than threshold GO-R1005
Anti-pattern
Minor
a month agoa month old
func FlagsToStruct has a cyclomatic complexity of 16 with "high" risk
 42}
 43
 44// FlagsToStruct applies flag to a Struct using `flag` tags
 45func FlagsToStruct(s interface{}, flags *pflag.FlagSet) error { 46	ref := reflect.ValueOf(s).Elem()
 47	fields := reflect.VisibleFields(ref.Type())
 48	// get a list of all flags present in the command
func watchBuildPhase has a cyclomatic complexity of 16 with "high" risk
378	}
379}
380
381func watchBuildPhase(a *app.App, buildStatus *app.BuildStatus) error {382	ui.StartSpinner()
383	buildStatus, err := a.GetBuildStatus(buildStatus.BuildNumber)
384	if err != nil {
func StreamEvents has a cyclomatic complexity of 22 with "high" risk
266	return nil
267}
268
269func StreamEvents(sess *session.Session, logURL string, marker *string, stopTailing <-chan bool) error {270	var lastSeenTime *int64
271	var seenEventIDs map[string]bool
272	var markerStart *string
func watchBuild has a cyclomatic complexity of 26 with "very-high" risk
118	return buildStatus, nil
119}
120
121func watchBuild(a *app.App, buildStatus *app.BuildStatus) error {122	var lastPhase *app.BuildPhase
123	var currentPhase *app.BuildPhase
124	var failedPhase *app.BuildPhase
func SetScaleParameter has a cyclomatic complexity of 19 with "high" risk
 983
 984// SetScaleParameter updates process count and cpu/ram with any non-nil values provided
 985// if it is not yet set, the defaults from ECSConfig will be used
 986func (a *App) SetScaleParameter(processType string, minProcessCount, maxProcessCount, cpu, memory *int) error { 987	ssmSvc := ssm.New(a.Session)
 988	var parameterName string
 989	if a.IsReviewApp() {