use of org.sonar.server.computation.task.projectanalysis.component.TypeAwareVisitorAdapter in project sonarqube by SonarSource.
the class FileMoveDetectionStep method getReportFilesByKey.
private static Map<String, Component> getReportFilesByKey(Component root) {
final ImmutableMap.Builder<String, Component> builder = ImmutableMap.builder();
new DepthTraversalTypeAwareCrawler(new TypeAwareVisitorAdapter(CrawlerDepthLimit.FILE, POST_ORDER) {
@Override
public void visitFile(Component file) {
builder.put(file.getKey(), file);
}
}).visit(root);
return builder.build();
}
use of org.sonar.server.computation.task.projectanalysis.component.TypeAwareVisitorAdapter in project sonarqube by SonarSource.
the class LoadDuplicationsFromReportStep method execute.
@Override
public void execute() {
new DepthTraversalTypeAwareCrawler(new TypeAwareVisitorAdapter(CrawlerDepthLimit.FILE, POST_ORDER) {
@Override
public void visitFile(Component file) {
CloseableIterator<ScannerReport.Duplication> duplications = batchReportReader.readComponentDuplications(file.getReportAttributes().getRef());
try {
int idGenerator = 1;
while (duplications.hasNext()) {
loadDuplications(file, duplications.next(), idGenerator);
idGenerator++;
}
} finally {
duplications.close();
}
}
}).visit(treeRootHolder.getRoot());
}
Aggregations