concourse / concourse

Empty string test can be improved CRT-A0004
Anti-pattern
Major
4 months ago4 years old
replace len(value) == 0 with value == ""
 48			labelSet[chunkKey] = value[:valueLen]
 49			value = value[valueLen:]
 50
 51			if len(value) == 0 { 52				break
 53			}
 54
replace len(token) == 0 with token == ""
295		}
296		tokenBytes, err := pty.ReadLine(os.Stdin)
297		token := strings.TrimSpace(string(tokenBytes))
298		if len(token) == 0 && err == io.EOF {299			return
300		}
301		if err != nil && err != io.EOF {
replace len(w.GardenAddr) == 0 with w.GardenAddr == ""
66		return ErrInvalidWorkerVersion
67	}
68
69	if len(w.GardenAddr) == 0 {70		return ErrMissingWorkerGardenAddress
71	}
72
replace len(row.BuildStatus) != 0 with row.BuildStatus != ""
815	}
816
817	buildStatus := "succeeded"
818	if len(row.BuildStatus) != 0 {819		buildStatus = row.BuildStatus
820	}
821
replace len(input.Version.Pinned) != 0 with input.Version.Pinned != ""
170			JobID:           setup.jobIDs.ID(CurrentJobName),
171		}
172
173		if len(input.Version.Pinned) != 0 {174			inputConfigs[i].PinnedVersion = atc.Version{"ver": input.Version.Pinned}
175
176			setup.insertPinned(setup.resourceIDs.ID(input.Resource), atc.Version{"ver": input.Version.Pinned})