@Test public void complexity() throws IOException { final CharStream charStream = CharStreams.fromStream(this.getClass().getResourceAsStream("/dart/complexity.dart")); final Dart2Lexer lexer = new Dart2Lexer(charStream); lexer.removeErrorListeners(); final CommonTokenStream stream = new CommonTokenStream(lexer); stream.fill(); final Dart2Parser parser = new Dart2Parser(stream); parser.removeErrorListeners(); final ParseTree root = parser.compilationUnit(); CyclomaticComplexityVisitor visitor = new CyclomaticComplexityVisitor(); CustomTreeVisitor customTreeVisitor = new CustomTreeVisitor(visitor); customTreeVisitor.visit(root); assertThat(visitor.getComplexity()).isEqualTo(7); }
public int getComplexity() { return complexity; }
CyclomaticComplexityVisitor implements ParseTreeItemVisitor { public int getComplexity() { return complexity; } }
CyclomaticComplexityVisitor implements ParseTreeItemVisitor { public int getComplexity() { return complexity; }  }
CyclomaticComplexityVisitor implements ParseTreeItemVisitor { public int getComplexity() { return complexity; }  @Override void apply(ParseTree tree); @Override void fillContext(SensorContext context, AntlrContext antlrContext); int getComplexity(); }
CyclomaticComplexityVisitor implements ParseTreeItemVisitor { public int getComplexity() { return complexity; }  @Override void apply(ParseTree tree); @Override void fillContext(SensorContext context, AntlrContext antlrContext); int getComplexity();  }