Reduce Cyclomatic Complexity of Switch Statement - Sonar

前端 未结 7 1841
囚心锁ツ
囚心锁ツ 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:07

    You can remove all the null comparisons and check it prior to switch case. In that case complexity will reduce by 4 or may be more.

提交回复
热议问题