@Test public void jumps() { assertThat(complexity("break;").value()).isEqualTo(0); assertThat(complexity("break foo;").value()).isEqualTo(1); assertThat(complexity("while (x) break;").value()).isEqualTo(1); assertThat(complexity("while (x) break foo;").value()).isEqualTo(2); assertThat(complexity("continue;").value()).isEqualTo(0); assertThat(complexity("continue foo;").value()).isEqualTo(1); assertThat(complexity("while (x) continue;").value()).isEqualTo(1); assertThat(complexity("while (x) continue foo;").value()).isEqualTo(2); }
public int value() { int total = 0; for (Increment increment : increments) { total += increment.nestingLevel + 1; } return total; }
CognitiveComplexity { public int value() { int total = 0; for (Increment increment : increments) { total += increment.nestingLevel + 1; } return total; } }
CognitiveComplexity { public int value() { int total = 0; for (Increment increment : increments) { total += increment.nestingLevel + 1; } return total; } CognitiveComplexity(Tree root); }
CognitiveComplexity { public int value() { int total = 0; for (Increment increment : increments) { total += increment.nestingLevel + 1; } return total; } CognitiveComplexity(Tree root); int value(); List<Increment> increments(); }
CognitiveComplexity { public int value() { int total = 0; for (Increment increment : increments) { total += increment.nestingLevel + 1; } return total; } CognitiveComplexity(Tree root); int value(); List<Increment> increments();  }