aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-scanner-engine/src/main/java/org')
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/IssuePublisher.java23
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java6
2 files changed, 23 insertions, 6 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/IssuePublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/IssuePublisher.java
index 48ac551dd1c..f9b38d860cb 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/IssuePublisher.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/IssuePublisher.java
@@ -25,13 +25,14 @@ import javax.annotation.Nullable;
import javax.annotation.concurrent.ThreadSafe;
import org.apache.commons.lang.StringUtils;
import org.sonar.api.batch.fs.TextRange;
+import org.sonar.api.batch.fs.internal.DefaultInputComponent;
+import org.sonar.api.batch.fs.internal.DefaultInputFile;
import org.sonar.api.batch.rule.ActiveRule;
import org.sonar.api.batch.rule.ActiveRules;
import org.sonar.api.batch.sensor.issue.ExternalIssue;
import org.sonar.api.batch.sensor.issue.Issue;
import org.sonar.api.batch.sensor.issue.Issue.Flow;
-import org.sonar.api.batch.fs.internal.DefaultInputComponent;
-import org.sonar.api.batch.fs.internal.DefaultInputFile;
+import org.sonar.api.batch.sensor.issue.internal.DefaultIssueFlow;
import org.sonar.scanner.protocol.Constants.Severity;
import org.sonar.scanner.protocol.output.ScannerReport;
import org.sonar.scanner.protocol.output.ScannerReport.IssueLocation;
@@ -160,7 +161,8 @@ public class IssuePublisher {
private static void applyFlows(Consumer<ScannerReport.Flow> consumer, ScannerReport.IssueLocation.Builder locationBuilder,
ScannerReport.TextRange.Builder textRangeBuilder, Collection<Flow> flows) {
ScannerReport.Flow.Builder flowBuilder = ScannerReport.Flow.newBuilder();
- for (Flow flow : flows) {
+ for (Flow f : flows) {
+ DefaultIssueFlow flow = (DefaultIssueFlow) f;
if (flow.locations().isEmpty()) {
return;
}
@@ -179,10 +181,25 @@ public class IssuePublisher {
}
flowBuilder.addLocation(locationBuilder.build());
}
+ if (flow.getDescription() != null) {
+ flowBuilder.setDescription(flow.getDescription());
+ }
+ flowBuilder.setType(toProtobufFlowType(flow.getType()));
consumer.accept(flowBuilder.build());
}
}
+ private static ScannerReport.FlowType toProtobufFlowType(DefaultIssueFlow.Type flowType) {
+ switch (flowType) {
+ case EXECUTION:
+ return ScannerReport.FlowType.EXECUTION;
+ case DATA:
+ return ScannerReport.FlowType.DATA;
+ default:
+ return ScannerReport.FlowType.UNDEFINED;
+ }
+ }
+
private static ScannerReport.TextRange toProtobufTextRange(ScannerReport.TextRange.Builder textRangeBuilder, TextRange primaryTextRange) {
textRangeBuilder.clear();
textRangeBuilder.setStartLine(primaryTextRange.start().line());
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java
index 574fdd1e2a1..0fc66aa1c5f 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java
@@ -79,9 +79,9 @@ public class ReportPublisher implements Startable {
private final ScanProperties properties;
private final CeTaskReportDataHolder ceTaskReportDataHolder;
- private Path reportDir;
- private ScannerReportWriter writer;
- private ScannerReportReader reader;
+ private final Path reportDir;
+ private final ScannerReportWriter writer;
+ private final ScannerReportReader reader;
public ReportPublisher(ScanProperties properties, DefaultScannerWsClient wsClient, Server server, AnalysisContextReportPublisher contextPublisher,
InputModuleHierarchy moduleHierarchy, GlobalAnalysisMode analysisMode, TempFolder temp, ReportPublisherStep[] publishers, BranchConfiguration branchConfiguration,