Reduce Cyclomatic Complexity of Switch Statement - Sonar

前端 未结 7 1833
囚心锁ツ
囚心锁ツ 2021-01-17 22:50

I want to reduce cyclomatic complexity of my switch case my code is :

public String getCalenderName() {
        switch (type) {
    case COUNTRY:
        r         


        
7条回答
  •  囚心锁ツ
    2021-01-17 23:05

    As per my knowledge, do not use return statement in switch statement. Apply that logic after the switch statement using a variable. Create a method for checking the null value and call that method from switch then you will able to reduce the Cyclomatic Complexity

提交回复
热议问题