Function with cyclomatic complexity higher than threshold GO-R1005
Anti-pattern
Minor
6 months ago6 months old
func reconcile has a cyclomatic complexity of 28 with "very-high" risk
159	return nil, nil
160}
161
162func (e *etcdSnapshotHandler) reconcile() error {163	// Get a list of all etcd nodes currently in the cluster.
164	// We will use this list to prune local entries for any node that does not exist.
165	nodes := e.etcd.config.Runtime.Core.Core().V1().Node()
func sync has a cyclomatic complexity of 16 with "high" risk
 57	go wait.JitterUntil(func() { snapshots.Enqueue(reconcileKey) }, reconcileInterval, 0.04, false, ctx.Done())
 58}
 59
 60func (e *etcdSnapshotHandler) sync(key string, esf *apisv1.ETCDSnapshotFile) (*apisv1.ETCDSnapshotFile, error) { 61	if key == reconcileKey {
 62		err := e.reconcile()
 63		if err == errNotReconciled {
func manageLearners has a cyclomatic complexity of 18 with "high" risk
1022// manageLearners monitors the etcd cluster to ensure that learners are making progress towards
1023// being promoted to full voting member. The checks only run on the cluster member that is
1024// the etcd leader.
1025func (e *ETCD) manageLearners(ctx context.Context) {1026	<-e.config.Runtime.AgentReady
1027	t := time.NewTicker(manageTickerTime)
1028	defer t.Stop()
func join has a cyclomatic complexity of 17 with "high" risk
 494}
 495
 496// join attempts to add a member to an existing cluster
 497func (e *ETCD) join(ctx context.Context, clientAccessInfo *clientaccess.Info) error { 498	clientCtx, cancel := context.WithTimeout(ctx, 20*time.Second)
 499	defer cancel()
 500
func Start has a cyclomatic complexity of 18 with "high" risk
 394}
 395
 396// Start starts the datastore
 397func (e *ETCD) Start(ctx context.Context, clientAccessInfo *clientaccess.Info) error { 398	isInitialized, err := e.IsInitialized()
 399	if err != nil {
 400		return errors.Wrapf(err, "failed to check for initialized etcd datastore")