pkg/cd/cd.go
Showing 15 of 15 total issues
Method cd.GetClusterStateV1
has a Cognitive Complexity of 70 (exceeds 20 allowed). Consider refactoring. Open
Open
func (c *cd) GetClusterStateV1(ctx context.Context, params *GetClusterStateParams) (clusterState *ClusterState, err error) { const op = "cd: get cluster status" defer wlog.Start(ctx, op).StopPrint()
- Read upRead up
Method cd.GetClusterStateV1
has 141 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (c *cd) GetClusterStateV1(ctx context.Context, params *GetClusterStateParams) (clusterState *ClusterState, err error) { const op = "cd: get cluster status" defer wlog.Start(ctx, op).StopPrint()
File cd.go
has 527 lines of code (exceeds 500 allowed). Consider refactoring. Open
Open
/*Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.
Method cd.GetClusterState
has 70 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (c *cd) GetClusterState(ctx context.Context, params *GetClusterStateV2Params) (*ClusterStateV2, error) { const op = "cd: get cluster status" defer wlog.Start(ctx, op).StopPrint()
Method cd.GetClusterState
has 15 return statements (exceeds 4 allowed). Open
Open
func (c *cd) GetClusterState(ctx context.Context, params *GetClusterStateV2Params) (*ClusterStateV2, error) { const op = "cd: get cluster status" defer wlog.Start(ctx, op).StopPrint()
Method cd.GetClusterStateV1
has 15 return statements (exceeds 4 allowed). Open
Open
func (c *cd) GetClusterStateV1(ctx context.Context, params *GetClusterStateParams) (clusterState *ClusterState, err error) { const op = "cd: get cluster status" defer wlog.Start(ctx, op).StopPrint()
Method cd.GetStep
has 51 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (c *cd) GetStep(ctx context.Context, params *GetStepParams) (*Step, error) { const op = "cd: get step" defer wlog.Start(ctx, op).StopPrint() _, kubeClient, err := c.kubeClientFactory.GetByK8SServer(params.RegionEntity.Server, params.RegionEntity.Certificate)
Method cd.GetStep
has 10 return statements (exceeds 4 allowed). Open
Open
func (c *cd) GetStep(ctx context.Context, params *GetStepParams) (*Step, error) { const op = "cd: get step" defer wlog.Start(ctx, op).StopPrint() _, kubeClient, err := c.kubeClientFactory.GetByK8SServer(params.RegionEntity.Server, params.RegionEntity.Certificate)
Method cd.GetClusterState
has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring. Open
Open
func (c *cd) GetClusterState(ctx context.Context, params *GetClusterStateV2Params) (*ClusterStateV2, error) { const op = "cd: get cluster status" defer wlog.Start(ctx, op).StopPrint()
- Read upRead up
Avoid deeply nested control flow statements. Open
Open
if _, ok := podMap[node.Name]; !ok { return nil, herrors.NewErrNotFound(herrors.PodsInK8S, fmt.Sprintf("pod %s does not exist", node.Name)) }
Method cd.GetResourceTree
has 6 return statements (exceeds 4 allowed). Open
Open
func (c *cd) GetResourceTree(ctx context.Context, params *GetResourceTreeParams) ([]ResourceNode, error) { const op = "cd: get resource tree" defer wlog.Start(ctx, op).StopPrint()
Method cd.CreateCluster
has 6 return statements (exceeds 4 allowed). Open
Open
func (c *cd) CreateCluster(ctx context.Context, params *CreateClusterParams) (err error) { const op = "cd: create cluster" defer wlog.Start(ctx, op).StopPrint() argo, err := c.factory.GetArgoCD(params.RegionEntity.Name, params.Environment)
Function NewCD
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func NewCD(informerFactories *regioninformers.RegionInformers, clusterGitRepo gitrepo.ClusterGitRepo, argoCDMapper argocdconf.Mapper, regionArgoCDMapper argocdconf.RegionMapper, targetRevision string) CD {
Method cd.DeleteCluster
has 5 return statements (exceeds 4 allowed). Open
Open
func (c *cd) DeleteCluster(ctx context.Context, params *DeleteClusterParams) (err error) { const op = "cd: delete cluster" defer wlog.Start(ctx, op).StopPrint() argo, err := c.factory.GetArgoCD(params.Region, params.Environment)
Method cd.GetPodEvents
has 5 return statements (exceeds 4 allowed). Open
Open
func (c *cd) GetPodEvents(ctx context.Context, params *GetPodEventsParams) (events []Event, err error) { const op = "cd: get cluster pod events" defer wlog.Start(ctx, op).StopPrint()