Function with cyclomatic complexity higher than threshold GO-R1005
Anti-pattern
Minor
5 hours ago10 months old
func TestHotWriteRegionScheduleByteRateOnlyWithTiFlash has a cyclomatic complexity of 21 with "high" risk
 621	clearPendingInfluence(hb.(*hotScheduler))
 622}
 623
 624func TestHotWriteRegionScheduleByteRateOnlyWithTiFlash(t *testing.T) { 625	re := require.New(t)
 626	cancel, _, tc, oc := prepareSchedulersTest()
 627	defer cancel()
func checkHotWriteRegionScheduleByteRateOnly has a cyclomatic complexity of 18 with "high" risk
 445	operatorutil.CheckTransferPeerWithLeaderTransfer(re, ops[0], operator.OpHotRegion, 1, 2)
 446}
 447
 448func checkHotWriteRegionScheduleByteRateOnly(re *require.Assertions, enablePlacementRules bool) { 449	cancel, opt, tc, oc := prepareSchedulersTest()
 450	defer cancel()
 451	tc.SetClusterVersion(versioninfo.MinSupportedVersion(versioninfo.ConfChangeV2))
func betterThanV1 has a cyclomatic complexity of 18 with "high" risk
1337}
1338
1339// betterThan checks if `bs.cur` is a better solution than `old`.
1340func (bs *balanceSolver) betterThanV1(old *solution) bool {1341	if old == nil || bs.cur.progressiveRank <= splitProgressiveRank {
1342		return true
1343	}
func filterDstStores has a cyclomatic complexity of 17 with "high" risk
1047}
1048
1049// filterDstStores select the candidate store by filters
1050func (bs *balanceSolver) filterDstStores() map[uint64]*statistics.StoreLoadDetail {1051	var (
1052		filters    []filter.Filter
1053		candidates []*statistics.StoreLoadDetail
func solve has a cyclomatic complexity of 21 with "high" risk
 685
 686// solve travels all the src stores, hot peers, dst stores and select each one of them to make a best scheduling solution.
 687// The comparing between solutions is based on calcProgressiveRank.
 688func (bs *balanceSolver) solve() []*operator.Operator { 689	if !bs.isValid() {
 690		return nil
 691	}