horizoncd/horizon

View on GitHub
pkg/cluster/tekton/log/task_reader.go

Summary

Maintainability
B
4 hrs
Test Coverage

Showing 3 of 3 total issues

Method Reader.readStepsLogs has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
Open

func (r *Reader) readStepsLogs(steps []*step, pod *pods.Pod, follow bool) (<-chan Log, <-chan error) {
logC := make(chan Log)
errC := make(chan error)
 
go func() {
Severity: Minor
Found in pkg/cluster/tekton/log/task_reader.go - About 1 hr to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

func getInitSteps(pod *corev1.Pod) []*step {
status := map[string]corev1.ContainerState{}
for _, ics := range pod.Status.InitContainerStatuses {
status[ics.Name] = ics.State
}
Severity: Major
Found in pkg/cluster/tekton/log/task_reader.go and 1 other location - About 1 hr to fix
pkg/cluster/tekton/log/task_reader.go on lines 188..204

Similar blocks of code found in 2 locations. Consider refactoring.
Open

func getSteps(pod *corev1.Pod) []*step {
status := map[string]corev1.ContainerState{}
for _, cs := range pod.Status.ContainerStatuses {
status[cs.Name] = cs.State
}
Severity: Major
Found in pkg/cluster/tekton/log/task_reader.go and 1 other location - About 1 hr to fix
pkg/cluster/tekton/log/task_reader.go on lines 170..186
Category
Status