Для следующей программы:
Код: Выделить всё
private static SomeDto checkSomething(AnotherDto anotherDto, String reference)
{
SomeDto someDto = new SomeDto();
// condition 1
if (!someDto.getA())
return new SomeDto("bla1", "blabla");
// condition 2
if (someDto.getName2() == null || checkSurName(anotherDto.getName()))
return new SomeDto("bla2", "blabla");
// condition 3
if (someDto.getName3() == null || checkSurName(anotherDto.getName()))
return new SomeDto("bla3", "blabla");
// condition 4
if (someDto.getName4() == null && checkSurName(anotherDto.getName()))
return new SomeDto("bla4", "blabla");
// condition 5
if (someDto.getName5() == null || checkSurName(anotherDto.getName()))
return new SomeDto("bla5", "blabla");
// condition 6
if (someDto.getName6() == null && checkSurName(anotherDto.getName()))
return new SomeDto("bla6", "blabla");
// condition 7
if (someDto.getName7() == null && checkSurName(anotherDto.getName()))
return new SomeDto("bla7", "blabla");
// condition 8
if (someDto.getName8() == null && checkSurName(anotherDto.getName()))
return new SomeDto("bla8", "blabla");
// condition 9
if (someDto.getName9() == null && checkSurName(anotherDto.getName()))
return new SomeDto("bla9", "blabla");
// condition 10
if (someDto.getName10() == null && checkSurName(anotherDto.getName()))
return new SomeDto("bla10", "blabla");
// condition 11
if (someDto.getName11() == null && checkSurName(anotherDto.getName()))
return new SomeDto("bla11", "blabla");
return someDto;
}
"Цикломатическая сложность этого метода "checkSomething" равна 22, что больше 12. авторизован."
Мой вопрос:
с учетом формулы Маккейба V(G) = E - N + 2, как Sonar достигает числа 22?
Где:
E = количество ребер
N = количество узлов
Сколько ребер и узлов в этом методе?
Каков поток управления для этого метода?
Мы используем SonarQube версии 6.3 (сборка 19869).
Подробнее здесь: https://stackoverflow.com/questions/461 ... complexity
Мобильная версия