aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-protocol
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2018-11-26 11:53:51 -0600
committersonartech <sonartech@sonarsource.com>2019-01-16 09:43:02 +0100
commit056023aba07e95f5e9bb1d5d2c4e611955458986 (patch)
treebfc5466d4328502b01c20d87759132057e709320 /sonar-scanner-protocol
parentf686185f25130fe4d84ae3b9307b784895414d5a (diff)
downloadsonarqube-056023aba07e95f5e9bb1d5d2c4e611955458986.tar.gz
sonarqube-056023aba07e95f5e9bb1d5d2c4e611955458986.zip
SONAR-11463 Remove path from scanner report and add module directories
Diffstat (limited to 'sonar-scanner-protocol')
-rw-r--r--sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java2
-rw-r--r--sonar-scanner-protocol/src/main/protobuf/scanner_report.proto3
-rw-r--r--sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportReaderTest.java4
-rw-r--r--sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportWriterTest.java16
4 files changed, 12 insertions, 13 deletions
diff --git a/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java b/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java
index dca9835a5b1..0b2f132e1c3 100644
--- a/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java
+++ b/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java
@@ -229,7 +229,7 @@ public class ScannerReportViewerApp {
return component.getName();
case DIRECTORY:
case FILE:
- return component.getPath();
+ return component.getProjectRelativePath();
default:
throw new IllegalArgumentException("Unknow component type: " + component.getType());
}
diff --git a/sonar-scanner-protocol/src/main/protobuf/scanner_report.proto b/sonar-scanner-protocol/src/main/protobuf/scanner_report.proto
index f81097b5a92..57f86f9a73a 100644
--- a/sonar-scanner-protocol/src/main/protobuf/scanner_report.proto
+++ b/sonar-scanner-protocol/src/main/protobuf/scanner_report.proto
@@ -47,6 +47,7 @@ message Metadata {
string scm_revision_id = 13;
string pull_request_key = 14;
+ map<string, string> modules_project_relative_path_by_key = 15;
message QProfile {
string key = 1;
@@ -101,8 +102,6 @@ message ComponentLink {
message Component {
int32 ref = 1;
- // Path relative to module base directory
- string path = 2 [deprecated=true];
string name = 3;
ComponentType type = 4;
bool is_test = 5;
diff --git a/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportReaderTest.java b/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportReaderTest.java
index 33b14b37ac1..68fe5aa7188 100644
--- a/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportReaderTest.java
+++ b/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportReaderTest.java
@@ -82,10 +82,10 @@ public class ScannerReportReaderTest {
ScannerReportWriter writer = new ScannerReportWriter(dir);
ScannerReport.Component.Builder component = ScannerReport.Component.newBuilder()
.setRef(1)
- .setPath("src/main/java/Foo.java");
+ .setProjectRelativePath("src/main/java/Foo.java");
writer.writeComponent(component.build());
- assertThat(underTest.readComponent(1).getPath()).isEqualTo("src/main/java/Foo.java");
+ assertThat(underTest.readComponent(1).getProjectRelativePath()).isEqualTo("src/main/java/Foo.java");
}
@Test(expected = IllegalStateException.class)
diff --git a/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportWriterTest.java b/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportWriterTest.java
index 2b6d3e402f1..ec33c74d38e 100644
--- a/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportWriterTest.java
+++ b/sonar-scanner-protocol/src/test/java/org/sonar/scanner/protocol/output/ScannerReportWriterTest.java
@@ -80,7 +80,7 @@ public class ScannerReportWriterTest {
ScannerReport.Component.Builder component = ScannerReport.Component.newBuilder()
.setRef(1)
.setLanguage("java")
- .setPath("src/Foo.java")
+ .setProjectRelativePath("src/Foo.java")
.setType(ComponentType.FILE)
.setIsTest(false)
.addChildRef(5)
@@ -142,13 +142,13 @@ public class ScannerReportWriterTest {
// write data
ScannerReport.AdHocRule rule = ScannerReport.AdHocRule.newBuilder()
- .setEngineId("eslint")
- .setRuleId("123")
- .setName("Foo")
- .setDescription("Description")
- .setSeverity(Constants.Severity.BLOCKER)
- .setType(ScannerReport.IssueType.BUG)
- .build();
+ .setEngineId("eslint")
+ .setRuleId("123")
+ .setName("Foo")
+ .setDescription("Description")
+ .setSeverity(Constants.Severity.BLOCKER)
+ .setType(ScannerReport.IssueType.BUG)
+ .build();
underTest.appendAdHocRule(rule);
File file = underTest.getFileStructure().adHocRules();