aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2019-11-19 10:28:55 -0600
committerSonarTech <sonartech@sonarsource.com>2019-12-09 20:46:17 +0100
commitebdae1d5b7916abb7e919c560b04841f0dfd21c6 (patch)
treedff14e70bbf3d19936e45f17ebc58dc48145586b /sonar-scanner-engine/src
parenta98070323ef55ce3934a564e0cf49a5e8fe03971 (diff)
downloadsonarqube-ebdae1d5b7916abb7e919c560b04841f0dfd21c6.tar.gz
sonarqube-ebdae1d5b7916abb7e919c560b04841f0dfd21c6.zip
SONAR-12673 Fix issue management
Diffstat (limited to 'sonar-scanner-engine/src')
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java2
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchConfiguration.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java8
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/BranchMediumTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MetadataPublisherTest.java2
5 files changed, 10 insertions, 10 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java
index ca4c9a32cf7..df01a38f0e0 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java
@@ -158,7 +158,7 @@ public class MetadataPublisher implements ReportPublisherStep {
builder.setBranchType(branchType);
String referenceBranch = branchConfiguration.referenceBranchName();
if (referenceBranch != null) {
- builder.setMergeBranchName(referenceBranch);
+ builder.setReferenceBranchName(referenceBranch);
}
String targetBranchName = branchConfiguration.targetBranchName();
if (targetBranchName != null) {
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchConfiguration.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchConfiguration.java
index eaa4003f7d3..1c41bb59905 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchConfiguration.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchConfiguration.java
@@ -45,8 +45,8 @@ public interface BranchConfiguration {
/**
* The branch from which we should load project settings/quality profiles/compare changed files/...
- * For branches, it's the to default branch in case of first analysis, otherwise it's the branch itself.
- * For PR, we look at sonar.pullrequest.base (default to default branch). If it exists but is a short living branch or PR, we will
+ * For branches, it's the default branch in case of first analysis, otherwise it's the branch itself.
+ * For PR, we look at sonar.pullrequest.base (default to default branch). If it exists and is not a PR we use it. If it exists but is a PR, we will
* transitively use its own target. If base is not analyzed, we will use default branch.
*
* @return null if the branch feature is not available or no branch was specified.
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java
index c769045d1f2..cede238b578 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java
@@ -383,7 +383,7 @@ public class ScannerMediumTester extends ExternalResource {
private BranchType branchType = BranchType.BRANCH;
private String branchName = null;
private String branchTarget = null;
- private String longLivingSonarReferenceBranch = null;
+ private String referenceBranchName = null;
@Override
public BranchType branchType() {
@@ -405,7 +405,7 @@ public class ScannerMediumTester extends ExternalResource {
@CheckForNull
@Override
public String referenceBranchName() {
- return longLivingSonarReferenceBranch;
+ return referenceBranchName;
}
@Override
@@ -462,8 +462,8 @@ public class ScannerMediumTester extends ExternalResource {
return this;
}
- public ScannerMediumTester setLongLivingSonarReferenceBranch(String longLivingSonarReferenceBranch) {
- this.branchConfiguration.longLivingSonarReferenceBranch = longLivingSonarReferenceBranch;
+ public ScannerMediumTester setReferenceBranchName(String referenceBranchNam) {
+ this.branchConfiguration.referenceBranchName = referenceBranchNam;
return this;
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/BranchMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/BranchMediumTest.java
index d71063345e7..7a28d8a4218 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/BranchMediumTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/BranchMediumTest.java
@@ -103,13 +103,13 @@ public class BranchMediumTest {
AnalysisResult result = getResult(tester
.setBranchName(branchName)
.setBranchTarget(branchTarget)
- .setLongLivingSonarReferenceBranch(branchTarget)
+ .setReferenceBranchName(branchTarget)
.setBranchType(BranchType.BRANCH));
ScannerReport.Metadata metadata = result.getReportReader().readMetadata();
assertThat(metadata.getBranchName()).isEqualTo(branchName);
assertThat(metadata.getBranchType()).isEqualTo(ScannerReport.Metadata.BranchType.BRANCH);
- assertThat(metadata.getMergeBranchName()).isEqualTo(branchTarget);
+ assertThat(metadata.getReferenceBranchName()).isEqualTo(branchTarget);
}
private AnalysisResult getResult(ScannerMediumTester tester) {
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MetadataPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MetadataPublisherTest.java
index cdff80a8414..c51bf18d1c5 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MetadataPublisherTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MetadataPublisherTest.java
@@ -236,7 +236,7 @@ public class MetadataPublisherTest {
ScannerReport.Metadata metadata = reader.readMetadata();
assertThat(metadata.getBranchName()).isEqualTo(branchName);
assertThat(metadata.getBranchType()).isEqualTo(ScannerReport.Metadata.BranchType.BRANCH);
- assertThat(metadata.getMergeBranchName()).isEmpty();
+ assertThat(metadata.getReferenceBranchName()).isEmpty();
assertThat(metadata.getTargetBranchName()).isEqualTo(targetName);
}