Search in sources :

Example 1 with DepthTraversalTypeAwareCrawler

use of org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler in project sonarqube by SonarSource.

the class ComputeMeasureVariationsStep method execute.

@Override
public void execute() {
    try (DbSession dbSession = dbClient.openSession(false)) {
        List<Metric> metrics = StreamSupport.stream(metricRepository.getAll().spliterator(), false).filter(isNumeric()).collect(Collectors.toList());
        new DepthTraversalTypeAwareCrawler(new VariationMeasuresVisitor(dbSession, metrics)).visit(treeRootHolder.getRoot());
    }
}
Also used : DbSession(org.sonar.db.DbSession) DepthTraversalTypeAwareCrawler(org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler) Metric(org.sonar.server.computation.task.projectanalysis.metric.Metric)

Example 2 with DepthTraversalTypeAwareCrawler

use of org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler in project sonarqube by SonarSource.

the class PersistCrossProjectDuplicationIndexStep method execute.

@Override
public void execute() {
    if (!crossProjectDuplicationStatusHolder.isEnabled()) {
        return;
    }
    try (DbSession dbSession = dbClient.openSession(true)) {
        Component project = treeRootHolder.getRoot();
        new DepthTraversalTypeAwareCrawler(new DuplicationVisitor(dbSession, analysisMetadataHolder.getUuid())).visit(project);
        dbSession.commit();
    }
}
Also used : DbSession(org.sonar.db.DbSession) DepthTraversalTypeAwareCrawler(org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler) Component(org.sonar.server.computation.task.projectanalysis.component.Component)

Example 3 with DepthTraversalTypeAwareCrawler

use of org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler in project sonarqube by SonarSource.

the class PersistProjectLinksStep method execute.

@Override
public void execute() {
    try (DbSession session = dbClient.openSession(false)) {
        new DepthTraversalTypeAwareCrawler(new ProjectLinkVisitor(session)).visit(treeRootHolder.getRoot());
        session.commit();
    }
}
Also used : DbSession(org.sonar.db.DbSession) DepthTraversalTypeAwareCrawler(org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler)

Example 4 with DepthTraversalTypeAwareCrawler

use of org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler in project sonarqube by SonarSource.

the class PersistTestsStep method execute.

@Override
public void execute() {
    try (DbSession dbSession = dbClient.openSession(true)) {
        TestDepthTraversalTypeAwareVisitor visitor = new TestDepthTraversalTypeAwareVisitor(dbSession);
        new DepthTraversalTypeAwareCrawler(visitor).visit(treeRootHolder.getRoot());
        dbSession.commit();
        if (visitor.hasUnprocessedCoverageDetails) {
            LOG.warn("Some coverage tests are not taken into account during analysis of project '{}'", visitor.getProjectKey());
        }
    }
}
Also used : DbSession(org.sonar.db.DbSession) DepthTraversalTypeAwareCrawler(org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler)

Example 5 with DepthTraversalTypeAwareCrawler

use of org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler in project sonarqube by SonarSource.

the class ValidateProjectStep method execute.

@Override
public void execute() {
    try (DbSession dbSession = dbClient.openSession(false)) {
        Component root = treeRootHolder.getRoot();
        List<ComponentDto> baseModules = dbClient.componentDao().selectEnabledModulesFromProjectKey(dbSession, root.getKey());
        Map<String, ComponentDto> baseModulesByKey = from(baseModules).uniqueIndex(ComponentDto::key);
        ValidateProjectsVisitor visitor = new ValidateProjectsVisitor(dbSession, dbClient.componentDao(), baseModulesByKey);
        new DepthTraversalTypeAwareCrawler(visitor).visit(root);
        if (!visitor.validationMessages.isEmpty()) {
            throw MessageException.of("Validation of project failed:\n  o " + MESSAGES_JOINER.join(visitor.validationMessages));
        }
    }
}
Also used : DbSession(org.sonar.db.DbSession) DepthTraversalTypeAwareCrawler(org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler) ComponentDto(org.sonar.db.component.ComponentDto) Component(org.sonar.server.computation.task.projectanalysis.component.Component)

Aggregations

DepthTraversalTypeAwareCrawler (org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler)10 DbSession (org.sonar.db.DbSession)8 Component (org.sonar.server.computation.task.projectanalysis.component.Component)4 TypeAwareVisitorAdapter (org.sonar.server.computation.task.projectanalysis.component.TypeAwareVisitorAdapter)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 ComponentDto (org.sonar.db.component.ComponentDto)1 Duplication (org.sonar.server.computation.task.projectanalysis.duplication.Duplication)1 Metric (org.sonar.server.computation.task.projectanalysis.metric.Metric)1