horizoncd/horizon

View on GitHub
pkg/cd/k8sutil.go

Summary

Maintainability
A
2 hrs
Test Coverage

Showing 2 of 2 total issues

Method cd.traverseResourceTree has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
Open

func (c *cd) traverseResourceTree(resourceTree *applicationV1alpha1.ApplicationTree,
operators ...TraverseOperator) {
m := make(map[string]*applicationV1alpha1.ResourceNode)
for i, node := range resourceTree.Nodes {
m[node.UID] = &resourceTree.Nodes[i]
Severity: Minor
Found in pkg/cd/k8sutil.go - About 1 hr to fix

Method util.ExecuteAction has 7 return statements (exceeds 4 allowed).
Open

func (e *util) ExecuteAction(ctx context.Context,
params *ExecuteActionParams) (err error) {
err = e.informerFactories.GetDynamicClientSet(params.RegionEntity.ID, func(clientset dynamic.Interface) error {
un, err := clientset.Resource(params.GVR).Namespace(params.Namespace).
Get(ctx, params.ResourceName, metav1.GetOptions{})
Severity: Major
Found in pkg/cd/k8sutil.go - About 45 mins to fix

    There are no issues that match your filters.

    Category
    Status