Search in sources :

Example 1 with Flow

use of org.sonar.api.batch.sensor.issue.Issue.Flow in project sonarqube by SonarSource.

the class ModuleIssues method applyFlows.

private static void applyFlows(ScannerReport.Issue.Builder builder, ScannerReport.IssueLocation.Builder locationBuilder, ScannerReport.TextRange.Builder textRangeBuilder, Issue issue) {
    ScannerReport.Flow.Builder flowBuilder = ScannerReport.Flow.newBuilder();
    for (Flow flow : issue.flows()) {
        if (flow.locations().isEmpty()) {
            return;
        }
        flowBuilder.clear();
        for (org.sonar.api.batch.sensor.issue.IssueLocation location : flow.locations()) {
            locationBuilder.clear();
            locationBuilder.setComponentRef(((DefaultInputComponent) location.inputComponent()).batchId());
            String message = location.message();
            if (message != null) {
                locationBuilder.setMsg(message);
            }
            TextRange textRange = location.textRange();
            if (textRange != null) {
                locationBuilder.setTextRange(toProtobufTextRange(textRangeBuilder, textRange));
            }
            flowBuilder.addLocation(locationBuilder.build());
        }
        builder.addFlow(flowBuilder.build());
    }
}
Also used : TextRange(org.sonar.api.batch.fs.TextRange) Flow(org.sonar.api.batch.sensor.issue.Issue.Flow)

Aggregations

TextRange (org.sonar.api.batch.fs.TextRange)1 Flow (org.sonar.api.batch.sensor.issue.Issue.Flow)1