use of org.sonar.duplications.index.MemoryCloneIndex in project sonarqube by SonarSource.
the class JavaDuplicationsFunctionalTest method detect.
private List<CloneGroup> detect(String... lines) {
String sourceCode = Arrays.stream(lines).collect(joining("\n"));
MemoryCloneIndex index = new MemoryCloneIndex();
List<Statement> statements = STATEMENT_CHUNKER.chunk(TOKEN_CHUNKER.chunk(sourceCode));
List<Block> blocks = BLOCK_CHUNKER.chunk("resourceId", statements);
for (Block block : blocks) {
index.insert(block);
}
return detect(index, blocks);
}
Aggregations