@Test public void binary_operators() { assertThat(complexity("a == b;").value()).isEqualTo(0); assertThat(complexity("a && b;").value()).isEqualTo(1); assertThat(complexity("a || b;").value()).isEqualTo(1); assertThat(complexity("a && b && c;").value()).isEqualTo(1); assertThat(complexity("a || b || c;").value()).isEqualTo(1); assertThat(complexity("a || b && c;").value()).isEqualTo(2); assertThat(complexity("a || b && c || d;").value()).isEqualTo(3); }
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();  }