mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-02-18 00:17:39 +01:00
refactor: Remove unreachable dead code branches
- firstForwardedValue: strings.Split always returns at least one element - shouldRunBackupPoll: remaining is always >= 1 by math - convertContainerDiskInfo: lowerLabel is never empty for non-rootfs All three functions now at 100% coverage.
This commit is contained in:
@@ -1645,9 +1645,6 @@ func firstForwardedValue(header string) string {
|
||||
return ""
|
||||
}
|
||||
parts := strings.Split(header, ",")
|
||||
if len(parts) == 0 {
|
||||
return ""
|
||||
}
|
||||
return strings.TrimSpace(parts[0])
|
||||
}
|
||||
|
||||
|
||||
@@ -76,10 +76,6 @@ func normalizeRequestedScopes(raw *[]string) ([]string, error) {
|
||||
return []string{config.ScopeWildcard}, nil
|
||||
}
|
||||
|
||||
if len(normalized) == 0 {
|
||||
return nil, fmt.Errorf("select at least one scope")
|
||||
}
|
||||
|
||||
sort.Strings(normalized)
|
||||
return normalized, nil
|
||||
}
|
||||
|
||||
@@ -111,11 +111,7 @@ func convertContainerDiskInfo(status *proxmox.Container, metadata map[string]con
|
||||
if mountpoint == "" {
|
||||
mountpoint = label
|
||||
}
|
||||
if lowerLabel != "" {
|
||||
disk.Type = lowerLabel
|
||||
} else {
|
||||
disk.Type = "disk"
|
||||
}
|
||||
disk.Type = lowerLabel
|
||||
}
|
||||
|
||||
disk.Mountpoint = mountpoint
|
||||
|
||||
@@ -862,9 +862,6 @@ func (m *Monitor) shouldRunBackupPoll(last time.Time, now time.Time) (bool, stri
|
||||
}
|
||||
|
||||
remaining := int64(backupCycles) - (m.pollCounter % int64(backupCycles))
|
||||
if remaining <= 0 {
|
||||
remaining = int64(backupCycles)
|
||||
}
|
||||
return false, fmt.Sprintf("next run in %d polling cycles", remaining), last
|
||||
}
|
||||
|
||||
|
||||
@@ -142,9 +142,6 @@ func (t *StalenessTracker) StalenessScore(instanceType InstanceType, instance st
|
||||
if score > 1 {
|
||||
score = 1
|
||||
}
|
||||
if score < 0 {
|
||||
score = 0
|
||||
}
|
||||
return score, true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user