Search in sources :

Example 1 with ProgressReport

use of org.sonar.scanner.util.ProgressReport in project sonarqube by SonarSource.

the class IssueTransition method execute.

public void execute() {
    if (localIssueTracking != null) {
        localIssueTracking.init();
    }
    ScannerReportReader reader = new ScannerReportReader(reportPublisher.getReportDir());
    int nbComponents = inputComponentStore.all().size();
    if (nbComponents == 0) {
        return;
    }
    ProgressReport progressReport = new ProgressReport("issue-tracking-report", TimeUnit.SECONDS.toMillis(10));
    progressReport.start("Performing issue tracking");
    int count = 0;
    try {
        for (InputComponent component : inputComponentStore.all()) {
            trackIssues(reader, (DefaultInputComponent) component);
            count++;
            progressReport.message(count + "/" + nbComponents + " components tracked");
        }
    } finally {
        progressReport.stop(count + "/" + nbComponents + " components tracked");
    }
}
Also used : ScannerReportReader(org.sonar.scanner.protocol.output.ScannerReportReader) DefaultInputComponent(org.sonar.api.batch.fs.internal.DefaultInputComponent) InputComponent(org.sonar.api.batch.fs.InputComponent) ProgressReport(org.sonar.scanner.util.ProgressReport)

Example 2 with ProgressReport

use of org.sonar.scanner.util.ProgressReport in project sonarqube by SonarSource.

the class FileIndexer method index.

void index(DefaultModuleFileSystem fileSystem) {
    int threads = Math.max(1, Runtime.getRuntime().availableProcessors() - 1);
    this.executorService = Executors.newFixedThreadPool(threads, new ThreadFactoryBuilder().setNameFormat("FileIndexer-%d").build());
    progressReport = new ProgressReport("Report about progress of file indexation", TimeUnit.SECONDS.toMillis(10));
    progressReport.start("Index files");
    exclusionFilters.prepare();
    Progress progress = new Progress();
    indexFiles(fileSystem, progress, fileSystem.sources(), InputFile.Type.MAIN);
    indexFiles(fileSystem, progress, fileSystem.tests(), InputFile.Type.TEST);
    waitForTasksToComplete();
    progressReport.stop(progress.count() + " " + pluralizeFiles(progress.count()) + " indexed");
    if (exclusionFilters.hasPattern()) {
        LOG.info("{} {} ignored because of inclusion/exclusion patterns", progress.excludedByPatternsCount(), pluralizeFiles(progress.excludedByPatternsCount()));
    }
}
Also used : ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder) ProgressReport(org.sonar.scanner.util.ProgressReport)

Aggregations

ProgressReport (org.sonar.scanner.util.ProgressReport)2 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1 InputComponent (org.sonar.api.batch.fs.InputComponent)1 DefaultInputComponent (org.sonar.api.batch.fs.internal.DefaultInputComponent)1 ScannerReportReader (org.sonar.scanner.protocol.output.ScannerReportReader)1