Search in sources :

Example 1 with HighlightingLineReader

use of org.sonar.ce.task.projectanalysis.source.linereader.HighlightingLineReader in project sonarqube by SonarSource.

the class SourceLineReadersFactory method getLineReaders.

public LineReaders getLineReaders(Component component) {
    List<LineReader> readers = new ArrayList<>();
    List<CloseableIterator<?>> closeables = new ArrayList<>();
    ScmLineReader scmLineReader = null;
    int componentRef = component.getReportAttributes().getRef();
    CloseableIterator<ScannerReport.LineCoverage> coverageIt = reportReader.readComponentCoverage(componentRef);
    closeables.add(coverageIt);
    readers.add(new CoverageLineReader(coverageIt));
    Optional<ScmInfo> scmInfoOptional = scmInfoRepository.getScmInfo(component);
    if (scmInfoOptional.isPresent()) {
        scmLineReader = new ScmLineReader(scmInfoOptional.get());
        readers.add(scmLineReader);
    }
    RangeOffsetConverter rangeOffsetConverter = new RangeOffsetConverter();
    CloseableIterator<ScannerReport.SyntaxHighlightingRule> highlightingIt = reportReader.readComponentSyntaxHighlighting(componentRef);
    closeables.add(highlightingIt);
    readers.add(new HighlightingLineReader(component, highlightingIt, rangeOffsetConverter));
    CloseableIterator<ScannerReport.Symbol> symbolsIt = reportReader.readComponentSymbols(componentRef);
    closeables.add(symbolsIt);
    readers.add(new SymbolsLineReader(component, symbolsIt, rangeOffsetConverter));
    readers.add(new DuplicationLineReader(duplicationRepository.getDuplications(component)));
    readers.add(new IsNewLineReader(newLinesRepository, component));
    return new LineReadersImpl(readers, scmLineReader, closeables);
}
Also used : CoverageLineReader(org.sonar.ce.task.projectanalysis.source.linereader.CoverageLineReader) CloseableIterator(org.sonar.core.util.CloseableIterator) SymbolsLineReader(org.sonar.ce.task.projectanalysis.source.linereader.SymbolsLineReader) ArrayList(java.util.ArrayList) IsNewLineReader(org.sonar.ce.task.projectanalysis.source.linereader.IsNewLineReader) HighlightingLineReader(org.sonar.ce.task.projectanalysis.source.linereader.HighlightingLineReader) DuplicationLineReader(org.sonar.ce.task.projectanalysis.source.linereader.DuplicationLineReader) DuplicationLineReader(org.sonar.ce.task.projectanalysis.source.linereader.DuplicationLineReader) ScmLineReader(org.sonar.ce.task.projectanalysis.source.linereader.ScmLineReader) LineReader(org.sonar.ce.task.projectanalysis.source.linereader.LineReader) SymbolsLineReader(org.sonar.ce.task.projectanalysis.source.linereader.SymbolsLineReader) IsNewLineReader(org.sonar.ce.task.projectanalysis.source.linereader.IsNewLineReader) CoverageLineReader(org.sonar.ce.task.projectanalysis.source.linereader.CoverageLineReader) HighlightingLineReader(org.sonar.ce.task.projectanalysis.source.linereader.HighlightingLineReader) ScmLineReader(org.sonar.ce.task.projectanalysis.source.linereader.ScmLineReader) RangeOffsetConverter(org.sonar.ce.task.projectanalysis.source.linereader.RangeOffsetConverter) ScmInfo(org.sonar.ce.task.projectanalysis.scm.ScmInfo)

Aggregations

ArrayList (java.util.ArrayList)1 ScmInfo (org.sonar.ce.task.projectanalysis.scm.ScmInfo)1 CoverageLineReader (org.sonar.ce.task.projectanalysis.source.linereader.CoverageLineReader)1 DuplicationLineReader (org.sonar.ce.task.projectanalysis.source.linereader.DuplicationLineReader)1 HighlightingLineReader (org.sonar.ce.task.projectanalysis.source.linereader.HighlightingLineReader)1 IsNewLineReader (org.sonar.ce.task.projectanalysis.source.linereader.IsNewLineReader)1 LineReader (org.sonar.ce.task.projectanalysis.source.linereader.LineReader)1 RangeOffsetConverter (org.sonar.ce.task.projectanalysis.source.linereader.RangeOffsetConverter)1 ScmLineReader (org.sonar.ce.task.projectanalysis.source.linereader.ScmLineReader)1 SymbolsLineReader (org.sonar.ce.task.projectanalysis.source.linereader.SymbolsLineReader)1 CloseableIterator (org.sonar.core.util.CloseableIterator)1