aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java3
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ChangedLinesPublisher.java2
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java10
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java25
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectScanContainer.java13
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchConfiguration.java4
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchType.java2
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/DefaultBranchConfiguration.java2
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputComponentStore.java2
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmChangedFilesProvider.java2
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmPublisher.java2
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorStorage.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/BranchMediumTest.java16
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/log/LogListenerTest.java18
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ChangedLinesPublisherTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ComponentsPublisherTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MetadataPublisherTest.java35
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java30
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultActiveRulesLoaderTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/BranchConfigurationProviderTest.java12
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/ProjectBranchesTest.java11
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scm/ScmChangedFilesProviderTest.java14
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/DefaultSensorStorageTest.java8
-rw-r--r--sonar-scanner-protocol/src/main/protobuf/scanner_report.proto3
-rw-r--r--sonar-ws/src/main/protobuf/ws-commons.proto1
26 files changed, 81 insertions, 148 deletions
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java
index d970b821f96..a03b11f1ded 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java
@@ -153,8 +153,7 @@ public class TaskFormatter {
Common.BranchType branchType = componentDtoCache.getBranchType(taskUuid)
.orElseThrow(() -> new IllegalStateException(format("Could not find branch type of task '%s'", taskUuid)));
switch (branchType) {
- case LONG:
- case SHORT:
+ case BRANCH:
builder.setBranchType(branchType);
builder.setBranch(b);
break;
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ChangedLinesPublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ChangedLinesPublisher.java
index 981ab317066..bc1ee68f97e 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ChangedLinesPublisher.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ChangedLinesPublisher.java
@@ -58,7 +58,7 @@ public class ChangedLinesPublisher implements ReportPublisherStep {
@Override
public void publish(ScannerReportWriter writer) {
String targetBranchName = branchConfiguration.targetBranchName();
- if (scmConfiguration.isDisabled() || !branchConfiguration.isShortOrPullRequest() || targetBranchName == null) {
+ if (scmConfiguration.isDisabled() || !branchConfiguration.isPullRequest() || targetBranchName == null) {
return;
}
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 a2916c884d4..d8f3e6c6606 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
@@ -25,6 +25,8 @@ import java.util.LinkedList;
import java.util.Map.Entry;
import java.util.regex.Pattern;
import javax.annotation.Nullable;
+import org.sonar.api.batch.fs.internal.AbstractProjectOrModule;
+import org.sonar.api.batch.fs.internal.DefaultInputModule;
import org.sonar.api.batch.scm.ScmProvider;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
@@ -32,8 +34,6 @@ import org.sonar.scanner.ProjectInfo;
import org.sonar.scanner.bootstrap.ScannerPlugin;
import org.sonar.scanner.bootstrap.ScannerPluginRepository;
import org.sonar.scanner.cpd.CpdSettings;
-import org.sonar.api.batch.fs.internal.AbstractProjectOrModule;
-import org.sonar.api.batch.fs.internal.DefaultInputModule;
import org.sonar.scanner.fs.InputModuleHierarchy;
import org.sonar.scanner.protocol.output.ScannerReport;
import org.sonar.scanner.protocol.output.ScannerReport.Metadata.BranchType;
@@ -173,10 +173,8 @@ public class MetadataPublisher implements ReportPublisherStep {
if (branchType == org.sonar.scanner.scan.branch.BranchType.PULL_REQUEST) {
return BranchType.PULL_REQUEST;
}
- if (branchType == org.sonar.scanner.scan.branch.BranchType.LONG) {
- return BranchType.LONG;
- }
- return BranchType.SHORT;
+
+ return BranchType.BRANCH;
}
private static String toSonarQubePath(Path path) {
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 157772c1057..fc88701bffc 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
@@ -47,6 +47,7 @@ import org.sonar.scanner.protocol.output.ScannerReportReader;
import org.sonar.scanner.protocol.output.ScannerReportWriter;
import org.sonar.scanner.scan.ScanProperties;
import org.sonar.scanner.scan.branch.BranchConfiguration;
+import org.sonar.scanner.scan.branch.BranchType;
import org.sonarqube.ws.Ce;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.HttpException;
@@ -57,9 +58,7 @@ import static java.net.URLEncoder.encode;
import static org.apache.commons.lang.StringUtils.EMPTY;
import static org.apache.commons.lang.StringUtils.isBlank;
import static org.sonar.core.util.FileUtils.deleteQuietly;
-import static org.sonar.scanner.scan.branch.BranchType.LONG;
import static org.sonar.scanner.scan.branch.BranchType.PULL_REQUEST;
-import static org.sonar.scanner.scan.branch.BranchType.SHORT;
public class ReportPublisher implements Startable {
@@ -254,7 +253,7 @@ public class ReportPublisher implements Startable {
.url();
}
- if (onLongLivingBranch(branchConfiguration)) {
+ if (onBranch(branchConfiguration)) {
return httpUrl.newBuilder()
.addPathSegment(DASHBOARD)
.addEncodedQueryParameter(ID, encoded(effectiveKey))
@@ -263,16 +262,6 @@ public class ReportPublisher implements Startable {
.url();
}
- if (onShortLivingBranch(branchConfiguration)) {
- return httpUrl.newBuilder()
- .addPathSegment(DASHBOARD)
- .addEncodedQueryParameter(ID, encoded(effectiveKey))
- .addEncodedQueryParameter(BRANCH, encoded(branchConfiguration.branchName()))
- .addQueryParameter(RESOLVED, "false")
- .build()
- .url();
- }
-
if (onMainBranch(branchConfiguration)) {
return httpUrl.newBuilder()
.addPathSegment(DASHBOARD)
@@ -288,12 +277,8 @@ public class ReportPublisher implements Startable {
return branchConfiguration.branchName() != null && (branchConfiguration.branchType() == PULL_REQUEST);
}
- private static boolean onShortLivingBranch(BranchConfiguration branchConfiguration) {
- return branchConfiguration.branchName() != null && (branchConfiguration.branchType() == SHORT);
- }
-
- private static boolean onLongLivingBranch(BranchConfiguration branchConfiguration) {
- return branchConfiguration.branchName() != null && (branchConfiguration.branchType() == LONG);
+ private static boolean onBranch(BranchConfiguration branchConfiguration) {
+ return branchConfiguration.branchName() != null && (branchConfiguration.branchType() == BranchType.BRANCH);
}
private static boolean onMainBranch(BranchConfiguration branchConfiguration) {
@@ -305,7 +290,7 @@ public class ReportPublisher implements Startable {
return EMPTY;
}
try {
- return encode(queryParameter, "UTF-8");
+ return encode(queryParameter, StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException("Unable to urlencode " + queryParameter, e);
}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectScanContainer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectScanContainer.java
index eadf6859a4e..b3210013584 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectScanContainer.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectScanContainer.java
@@ -340,7 +340,7 @@ public class ProjectScanContainer extends ComponentContainer {
LOG.info("Pull request {} for merge into {} from {}", branchConfig.pullRequestKey(), pullRequestBaseToDisplayName(branchConfig.targetBranchName()),
branchConfig.branchName());
} else if (branchConfig.branchName() != null) {
- LOG.info("Branch name: {}, type: {}", branchConfig.branchName(), branchTypeToDisplayName(branchConfig.branchType()));
+ LOG.info("Branch name: {}", branchConfig.branchName());
}
getComponentByType(ProjectFileIndexer.class).index();
@@ -374,17 +374,6 @@ public class ProjectScanContainer extends ComponentContainer {
return pullRequestBase != null ? pullRequestBase : "default branch";
}
- private static String branchTypeToDisplayName(BranchType branchType) {
- switch (branchType) {
- case LONG:
- return "long living";
- case SHORT:
- return "short living";
- default:
- throw new UnsupportedOperationException("unknown branch type: " + branchType);
- }
- }
-
private void scanRecursively(InputModuleHierarchy tree, DefaultInputModule module) {
for (DefaultInputModule child : tree.children(module)) {
scanRecursively(tree, child);
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 d3f51049c0d..26ab17a7b65 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
@@ -35,8 +35,8 @@ public interface BranchConfiguration {
*/
BranchType branchType();
- default boolean isShortOrPullRequest() {
- return branchType() == BranchType.PULL_REQUEST || branchType() == BranchType.SHORT;
+ default boolean isPullRequest() {
+ return branchType() == BranchType.PULL_REQUEST;
}
/**
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchType.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchType.java
index b087c398c47..bb84366d987 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchType.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchType.java
@@ -20,5 +20,5 @@
package org.sonar.scanner.scan.branch;
public enum BranchType {
- SHORT, LONG, PULL_REQUEST
+ BRANCH, PULL_REQUEST
}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/DefaultBranchConfiguration.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/DefaultBranchConfiguration.java
index 7314597a828..a708727ea4b 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/DefaultBranchConfiguration.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/DefaultBranchConfiguration.java
@@ -26,7 +26,7 @@ import javax.annotation.concurrent.Immutable;
public class DefaultBranchConfiguration implements BranchConfiguration {
@Override
public BranchType branchType() {
- return BranchType.LONG;
+ return BranchType.BRANCH;
}
@CheckForNull
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputComponentStore.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputComponentStore.java
index d961ae54785..9a9d21f2b35 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputComponentStore.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputComponentStore.java
@@ -79,7 +79,7 @@ public class InputComponentStore extends DefaultFileSystem.Cache {
public Iterable<DefaultInputFile> allChangedFilesToPublish() {
return allFilesToPublishStream()
- .filter(f -> !branchConfiguration.isShortOrPullRequest() || f.status() != InputFile.Status.SAME)::iterator;
+ .filter(f -> !branchConfiguration.isPullRequest() || f.status() != InputFile.Status.SAME)::iterator;
}
@Override
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmChangedFilesProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmChangedFilesProvider.java
index dfdcb165319..c8444d57cbe 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmChangedFilesProvider.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmChangedFilesProvider.java
@@ -56,7 +56,7 @@ public class ScmChangedFilesProvider extends ProviderAdapter {
@CheckForNull
private static Collection<Path> loadChangedFilesIfNeeded(ScmConfiguration scmConfiguration, BranchConfiguration branchConfiguration, Path rootBaseDir) {
final String targetBranchName = branchConfiguration.targetBranchName();
- if (branchConfiguration.isShortOrPullRequest() && targetBranchName != null) {
+ if (branchConfiguration.isPullRequest() && targetBranchName != null) {
ScmProvider scmProvider = scmConfiguration.provider();
if (scmProvider != null) {
Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG);
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmPublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmPublisher.java
index 57244da9b35..e4bba8c792b 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmPublisher.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scm/ScmPublisher.java
@@ -98,7 +98,7 @@ public final class ScmPublisher {
for (DefaultInputFile f : componentStore.allFilesToPublish()) {
if (configuration.forceReloadAll() || f.status() != Status.SAME) {
addIfNotEmpty(filesToBlame, f);
- } else if (!branchConfiguration.isShortOrPullRequest()) {
+ } else if (!branchConfiguration.isPullRequest()) {
FileData fileData = projectRepositoriesSupplier.get().fileData(componentStore.findModule(f).key(), f);
if (fileData == null || StringUtils.isEmpty(fileData.revision())) {
addIfNotEmpty(filesToBlame, f);
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorStorage.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorStorage.java
index 360dc439b0e..f02194528f5 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorStorage.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorStorage.java
@@ -214,7 +214,7 @@ public class DefaultSensorStorage implements SensorStorage {
}
private boolean shouldSkipStorage(DefaultInputFile defaultInputFile) {
- return branchConfiguration.isShortOrPullRequest() && defaultInputFile.status() == InputFile.Status.SAME;
+ return branchConfiguration.isPullRequest() && defaultInputFile.status() == InputFile.Status.SAME;
}
/**
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 be6be13b727..8025b03034b 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
@@ -380,7 +380,7 @@ public class ScannerMediumTester extends ExternalResource {
private static class FakeBranchConfiguration implements BranchConfiguration {
- private BranchType branchType = BranchType.LONG;
+ private BranchType branchType = BranchType.BRANCH;
private String branchName = null;
private String branchTarget = null;
private String longLivingSonarReferenceBranch = null;
@@ -410,7 +410,7 @@ public class ScannerMediumTester extends ExternalResource {
@Override
public String pullRequestKey() {
- throw new UnsupportedOperationException();
+ return "1'";
}
}
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 f376d56999e..d71063345e7 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
@@ -75,7 +75,7 @@ public class BranchMediumTest {
}
@Test
- public void should_not_skip_report_for_unchanged_files_in_short_branch() {
+ public void should_not_skip_report_for_unchanged_files_in_pr() {
// sanity check, normally report gets generated
AnalysisResult result = getResult(tester);
final DefaultInputFile file = (DefaultInputFile) result.inputFile(FILE_PATH);
@@ -85,11 +85,11 @@ public class BranchMediumTest {
assertThat(result.getReportReader().hasCoverage(fileId)).isTrue();
assertThat(result.getReportReader().readFileSource(fileId)).isNotNull();
- // file is not skipped for short branches (need coverage, duplications coming soon)
- AnalysisResult result2 = getResult(tester.setBranchType(BranchType.SHORT));
- final DefaultInputFile fileOnShortBranch = (DefaultInputFile) result2.inputFile(FILE_PATH);
- assertThat(result2.getReportComponent(fileOnShortBranch)).isNotNull();
- fileId = fileOnShortBranch.scannerId();
+ // file is not skipped for pull requests (need coverage, duplications coming soon)
+ AnalysisResult result2 = getResult(tester.setBranchType(BranchType.PULL_REQUEST));
+ final DefaultInputFile fileInPr = (DefaultInputFile) result2.inputFile(FILE_PATH);
+ assertThat(result2.getReportComponent(fileInPr)).isNotNull();
+ fileId = fileInPr.scannerId();
assertThat(result2.getReportReader().readChangesets(fileId)).isNull();
assertThat(result2.getReportReader().hasCoverage(fileId)).isTrue();
assertThat(result2.getReportReader().readFileSource(fileId)).isNull();
@@ -104,11 +104,11 @@ public class BranchMediumTest {
.setBranchName(branchName)
.setBranchTarget(branchTarget)
.setLongLivingSonarReferenceBranch(branchTarget)
- .setBranchType(BranchType.SHORT));
+ .setBranchType(BranchType.BRANCH));
ScannerReport.Metadata metadata = result.getReportReader().readMetadata();
assertThat(metadata.getBranchName()).isEqualTo(branchName);
- assertThat(metadata.getBranchType()).isEqualTo(ScannerReport.Metadata.BranchType.SHORT);
+ assertThat(metadata.getBranchType()).isEqualTo(ScannerReport.Metadata.BranchType.BRANCH);
assertThat(metadata.getMergeBranchName()).isEqualTo(branchTarget);
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/log/LogListenerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/log/LogListenerTest.java
index 74cdb214654..efccd3517bf 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/log/LogListenerTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/log/LogListenerTest.java
@@ -24,6 +24,7 @@ import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
+import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
@@ -67,7 +68,6 @@ public class LogListenerTest {
.setLogOutput(new SimpleLogListener());
private File baseDir;
-
private ImmutableMap.Builder<String, String> builder;
@BeforeClass
@@ -87,13 +87,13 @@ public class LogListenerTest {
}
@Before
- public void prepare() throws IOException {
+ public void prepare() {
stdOutTarget = new ByteArrayOutputStream();
stdErrTarget = new ByteArrayOutputStream();
System.setOut(new PrintStream(stdOutTarget));
System.setErr(new PrintStream(stdErrTarget));
// logger from the batch might write to it asynchronously
- logOutput = Collections.synchronizedList(new LinkedList<LogEvent>());
+ logOutput = Collections.synchronizedList(new LinkedList<>());
logOutputStr = new StringBuilder();
baseDir = temp.getRoot();
@@ -130,12 +130,12 @@ public class LogListenerTest {
}
@Test
- public void testChangeLogForAnalysis() throws IOException, InterruptedException {
+ public void testChangeLogForAnalysis() throws IOException {
File srcDir = new File(baseDir, "src");
srcDir.mkdir();
File xooFile = new File(srcDir, "sample.xoo");
- FileUtils.write(xooFile, "Sample xoo\ncontent");
+ FileUtils.write(xooFile, "Sample xoo\ncontent", StandardCharsets.UTF_8);
tester.newAnalysis()
.properties(builder
@@ -158,7 +158,7 @@ public class LogListenerTest {
srcDir.mkdir();
File xooFile = new File(srcDir, "sample.xoo");
- FileUtils.write(xooFile, "Sample xoo\ncontent");
+ FileUtils.write(xooFile, "Sample xoo\ncontent", StandardCharsets.UTF_8);
tester.newAnalysis()
.properties(builder
@@ -182,7 +182,7 @@ public class LogListenerTest {
srcDir.mkdir();
File xooFile = new File(srcDir, "sample.xoo");
- FileUtils.write(xooFile, "Sample xoo\ncontent");
+ FileUtils.write(xooFile, "Sample xoo\ncontent", StandardCharsets.UTF_8);
tester.newAnalysis()
.properties(builder
@@ -209,7 +209,7 @@ public class LogListenerTest {
File xooFile = new File(srcDir, "sample.xoo");
FileUtils.write(xooFile, "Sample xoo\ncontent");
File xooFileMeasure = new File(srcDir, "sample.xoo.measures");
- FileUtils.write(xooFileMeasure, "foo:bar");
+ FileUtils.write(xooFileMeasure, "foo:bar", StandardCharsets.UTF_8);
try {
tester.newAnalysis()
@@ -228,7 +228,7 @@ public class LogListenerTest {
for (LogEvent e : logOutput) {
if (e.level == Level.ERROR) {
assertThat(e.msg).contains("Error processing line 1 of file", "src" + File.separator + "sample.xoo.measures",
- "java.lang.IllegalStateException: Unknow metric with key: foo",
+ "java.lang.IllegalStateException: Unknown metric with key: foo",
"at org.sonar.xoo.lang.MeasureSensor.saveMeasure");
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ChangedLinesPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ChangedLinesPublisherTest.java
index 76d4f2285e7..9a2716d9bc6 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ChangedLinesPublisherTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ChangedLinesPublisherTest.java
@@ -66,7 +66,7 @@ public class ChangedLinesPublisherTest {
@Before
public void setUp() {
writer = new ScannerReportWriter(temp.getRoot());
- when(branchConfiguration.isShortOrPullRequest()).thenReturn(true);
+ when(branchConfiguration.isPullRequest()).thenReturn(true);
when(scmConfiguration.isDisabled()).thenReturn(false);
when(scmConfiguration.provider()).thenReturn(provider);
when(branchConfiguration.targetBranchName()).thenReturn(TARGET_BRANCH);
@@ -83,7 +83,7 @@ public class ChangedLinesPublisherTest {
@Test
public void skip_if_not_pr_or_slb() {
- when(branchConfiguration.isShortOrPullRequest()).thenReturn(false);
+ when(branchConfiguration.isPullRequest()).thenReturn(false);
publisher.publish(writer);
verifyZeroInteractions(inputComponentStore, inputModuleHierarchy, provider);
assertNotPublished();
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ComponentsPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ComponentsPublisherTest.java
index 0cd108c71df..6ee51409a7d 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ComponentsPublisherTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ComponentsPublisherTest.java
@@ -129,7 +129,7 @@ public class ComponentsPublisherTest {
@Test
public void publish_unchanged_components_even_in_short_branches() throws IOException {
- when(branchConfiguration.isShortOrPullRequest()).thenReturn(true);
+ when(branchConfiguration.isPullRequest()).thenReturn(true);
ProjectInfo projectInfo = mock(ProjectInfo.class);
when(projectInfo.getAnalysisDate()).thenReturn(DateUtils.parseDate("2012-12-12"));
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 9fab83409fb..cdff80a8414 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
@@ -38,14 +38,14 @@ import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
+import org.sonar.api.batch.fs.internal.DefaultInputModule;
+import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
import org.sonar.api.batch.scm.ScmProvider;
import org.sonar.scanner.ProjectInfo;
import org.sonar.scanner.bootstrap.ScannerPlugin;
import org.sonar.scanner.bootstrap.ScannerPluginRepository;
import org.sonar.scanner.cpd.CpdSettings;
-import org.sonar.api.batch.fs.internal.DefaultInputModule;
import org.sonar.scanner.fs.InputModuleHierarchy;
-import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
import org.sonar.scanner.protocol.output.ScannerReport;
import org.sonar.scanner.protocol.output.ScannerReportReader;
import org.sonar.scanner.protocol.output.ScannerReportWriter;
@@ -221,28 +221,13 @@ public class MetadataPublisherTest {
}
@Test
- public void write_long_lived_branch_info() throws Exception {
- String branchName = "long-lived";
- when(branches.branchName()).thenReturn(branchName);
- when(branches.branchType()).thenReturn(BranchType.LONG);
-
- File outputDir = temp.newFolder();
- underTest.publish(new ScannerReportWriter(outputDir));
+ public void write_branch_info() throws Exception {
+ String branchName = "name";
+ String targetName = "target";
- ScannerReportReader reader = new ScannerReportReader(outputDir);
- ScannerReport.Metadata metadata = reader.readMetadata();
- assertThat(metadata.getBranchName()).isEqualTo(branchName);
- assertThat(metadata.getBranchType()).isEqualTo(ScannerReport.Metadata.BranchType.LONG);
- }
-
- @Test
- public void write_short_lived_branch_info() throws Exception {
- String branchName = "feature";
- String targetBranchName = "short-lived";
- String longLivingSonarReferenceBranch = "long-lived";
when(branches.branchName()).thenReturn(branchName);
- when(branches.targetBranchName()).thenReturn(targetBranchName);
- when(branches.longLivingSonarReferenceBranch()).thenReturn(longLivingSonarReferenceBranch);
+ when(branches.branchType()).thenReturn(BranchType.BRANCH);
+ when(branches.targetBranchName()).thenReturn(targetName);
File outputDir = temp.newFolder();
underTest.publish(new ScannerReportWriter(outputDir));
@@ -250,9 +235,9 @@ public class MetadataPublisherTest {
ScannerReportReader reader = new ScannerReportReader(outputDir);
ScannerReport.Metadata metadata = reader.readMetadata();
assertThat(metadata.getBranchName()).isEqualTo(branchName);
- assertThat(metadata.getBranchType()).isEqualTo(ScannerReport.Metadata.BranchType.SHORT);
- assertThat(metadata.getMergeBranchName()).isEqualTo(longLivingSonarReferenceBranch);
- assertThat(metadata.getTargetBranchName()).isEqualTo(targetBranchName);
+ assertThat(metadata.getBranchType()).isEqualTo(ScannerReport.Metadata.BranchType.BRANCH);
+ assertThat(metadata.getMergeBranchName()).isEmpty();
+ assertThat(metadata.getTargetBranchName()).isEqualTo(targetName);
}
@Test
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java
index dee94ded490..a35094b32c8 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java
@@ -57,9 +57,8 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import static org.sonar.scanner.scan.branch.BranchType.LONG;
+import static org.sonar.scanner.scan.branch.BranchType.BRANCH;
import static org.sonar.scanner.scan.branch.BranchType.PULL_REQUEST;
-import static org.sonar.scanner.scan.branch.BranchType.SHORT;
public class ReportPublisherTest {
@@ -139,9 +138,9 @@ public class ReportPublisherTest {
}
@Test
- public void dump_public_url_if_defined_for_long_living_branches() throws IOException {
+ public void dump_public_url_if_defined_for_branches() throws IOException {
when(server.getPublicRootUrl()).thenReturn("https://publicserver/sonarqube");
- when(branchConfiguration.branchType()).thenReturn(LONG);
+ when(branchConfiguration.branchType()).thenReturn(BRANCH);
when(branchConfiguration.branchName()).thenReturn("branch-6.7");
ReportPublisher underTest = new ReportPublisher(properties, wsClient, server, contextPublisher, moduleHierarchy, mode, mock(TempFolder.class),
new ReportPublisherStep[0], branchConfiguration, reportMetadataHolder);
@@ -158,25 +157,6 @@ public class ReportPublisherTest {
}
@Test
- public void dump_public_url_if_defined_for_short_living_branches() throws IOException {
- when(server.getPublicRootUrl()).thenReturn("https://publicserver/sonarqube");
- when(branchConfiguration.branchType()).thenReturn(SHORT);
- when(branchConfiguration.branchName()).thenReturn("branch-6.7");
- ReportPublisher underTest = new ReportPublisher(properties, wsClient, server, contextPublisher, moduleHierarchy, mode, mock(TempFolder.class),
- new ReportPublisherStep[0], branchConfiguration, reportMetadataHolder);
-
- underTest.prepareAndDumpMetadata("TASK-123");
-
- assertThat(readFileToString(properties.metadataFilePath().toFile(), StandardCharsets.UTF_8)).isEqualTo(
- "projectKey=org.sonarsource.sonarqube:sonarqube\n" +
- "serverUrl=https://publicserver/sonarqube\n" +
- "serverVersion=6.4\n" +
- "dashboardUrl=https://publicserver/sonarqube/dashboard?id=org.sonarsource.sonarqube%3Asonarqube&branch=branch-6.7&resolved=false\n" +
- "ceTaskId=TASK-123\n" +
- "ceTaskUrl=https://publicserver/sonarqube/api/ce/task?id=TASK-123\n");
- }
-
- @Test
public void dump_public_url_if_defined_for_pull_request() throws IOException {
when(server.getPublicRootUrl()).thenReturn("https://publicserver/sonarqube");
when(branchConfiguration.branchName()).thenReturn("Bitbucket cloud Widget");
@@ -300,7 +280,7 @@ public class ReportPublisherTest {
String branchName = "feature";
when(branchConfiguration.branchName()).thenReturn(branchName);
- when(branchConfiguration.branchType()).thenReturn(SHORT);
+ when(branchConfiguration.branchType()).thenReturn(BRANCH);
WsResponse response = mock(WsResponse.class);
@@ -323,7 +303,7 @@ public class ReportPublisherTest {
assertThat(wsRequest.getParameters().getValues("organization")).containsExactly(orgName);
assertThat(wsRequest.getParameters().getValues("projectKey")).containsExactly("org.sonarsource.sonarqube:sonarqube");
assertThat(wsRequest.getParameters().getValues("characteristic"))
- .containsExactlyInAnyOrder("branch=" + branchName, "branchType=" + SHORT.name());
+ .containsExactlyInAnyOrder("branch=" + branchName, "branchType=" + BRANCH.name());
}
@Test
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultActiveRulesLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultActiveRulesLoaderTest.java
index 0dd61ad9ccf..7a4ece81a86 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultActiveRulesLoaderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultActiveRulesLoaderTest.java
@@ -61,7 +61,7 @@ public class DefaultActiveRulesLoaderTest {
public void setUp() {
wsClient = mock(DefaultScannerWsClient.class);
BranchConfiguration branchConfig = mock(BranchConfiguration.class);
- when(branchConfig.isShortOrPullRequest()).thenReturn(false);
+ when(branchConfig.isPullRequest()).thenReturn(false);
loader = new DefaultActiveRulesLoader(wsClient);
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/BranchConfigurationProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/BranchConfigurationProviderTest.java
index b77274c5d1a..9fb7cdd8d77 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/BranchConfigurationProviderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/BranchConfigurationProviderTest.java
@@ -29,9 +29,7 @@ import org.mockito.Captor;
import org.mockito.MockitoAnnotations;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
import org.sonar.api.batch.bootstrap.ProjectReactor;
-import org.sonar.scanner.bootstrap.GlobalServerSettings;
import org.sonar.scanner.scan.ProjectConfiguration;
-import org.sonar.scanner.scan.ProjectServerSettings;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.eq;
@@ -45,11 +43,11 @@ public class BranchConfigurationProviderTest {
private BranchConfiguration config = mock(BranchConfiguration.class);
private ProjectBranches branches = mock(ProjectBranches.class);
private ProjectPullRequests pullRequests = mock(ProjectPullRequests.class);
- private ProjectReactor reactor = mock(ProjectReactor.class);;
- private Map<String, String> projectSettings = new HashMap<>();;
+ private ProjectReactor reactor = mock(ProjectReactor.class);
+ ;
+ private Map<String, String> projectSettings = new HashMap<>();
+ ;
private ProjectDefinition root = mock(ProjectDefinition.class);
- private GlobalServerSettings globalServerSettings = mock(GlobalServerSettings.class);
- private ProjectServerSettings projectServerSettings = mock(ProjectServerSettings.class);
@Captor
private ArgumentCaptor<Supplier<Map<String, String>>> settingsCaptor;
@@ -81,6 +79,6 @@ public class BranchConfigurationProviderTest {
BranchConfiguration result = provider.provide(null, projectConfiguration, branches, pullRequests);
assertThat(result.targetBranchName()).isNull();
- assertThat(result.branchType()).isEqualTo(BranchType.LONG);
+ assertThat(result.branchType()).isEqualTo(BranchType.BRANCH);
}
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/ProjectBranchesTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/ProjectBranchesTest.java
index 40c6c59ee59..ee3967947f5 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/ProjectBranchesTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/ProjectBranchesTest.java
@@ -34,14 +34,13 @@ import static org.assertj.core.api.Assertions.assertThat;
@RunWith(DataProviderRunner.class)
public class ProjectBranchesTest {
- private static final BranchInfo mainBranch = new BranchInfo("main", BranchType.LONG, true, null);
- private static final BranchInfo shortBranch = new BranchInfo("short", BranchType.SHORT, false, null);
- private static final BranchInfo longBranch = new BranchInfo("long", BranchType.LONG, false, null);
+ private static final BranchInfo mainBranch = new BranchInfo("main", BranchType.BRANCH, true, null);
+ private static final BranchInfo branch = new BranchInfo("branch", BranchType.BRANCH, false, null);
private static final BranchInfo pullRequest = new BranchInfo("pull-request", BranchType.PULL_REQUEST, false, null);
- private static final List<BranchInfo> nonMainBranches = Arrays.asList(shortBranch, longBranch, pullRequest);
+ private static final List<BranchInfo> nonMainBranches = Arrays.asList(branch, pullRequest);
- private static final List<BranchInfo> allBranches = Arrays.asList(shortBranch, longBranch, pullRequest, mainBranch);
+ private static final List<BranchInfo> allBranches = Arrays.asList(branch, pullRequest, mainBranch);
private final ProjectBranches underTest = new ProjectBranches(allBranches);
@@ -63,7 +62,7 @@ public class ProjectBranchesTest {
@DataProvider
public static Object[][] branchNamesAndBranches() {
return allBranches.stream()
- .map(b -> new Object[]{b.name(), b})
+ .map(b -> new Object[] {b.name(), b})
.toArray(Object[][]::new);
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scm/ScmChangedFilesProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scm/ScmChangedFilesProviderTest.java
index 0e4205c45e8..b6953f8b850 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scm/ScmChangedFilesProviderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scm/ScmChangedFilesProviderTest.java
@@ -65,7 +65,7 @@ public class ScmChangedFilesProviderTest {
@Test
public void testNoScmProvider() {
- when(branchConfiguration.isShortOrPullRequest()).thenReturn(true);
+ when(branchConfiguration.isPullRequest()).thenReturn(true);
when(branchConfiguration.targetBranchName()).thenReturn("target");
ScmChangedFiles scmChangedFiles = provider.provide(scmConfiguration, branchConfiguration, project);
@@ -77,7 +77,7 @@ public class ScmChangedFilesProviderTest {
@Test
public void testFailIfRelativePath() {
when(branchConfiguration.targetBranchName()).thenReturn("target");
- when(branchConfiguration.isShortOrPullRequest()).thenReturn(true);
+ when(branchConfiguration.isPullRequest()).thenReturn(true);
when(scmConfiguration.provider()).thenReturn(scmProvider);
when(scmProvider.branchChangedFiles("target", rootBaseDir)).thenReturn(Collections.singleton(Paths.get("changedFile")));
@@ -89,7 +89,7 @@ public class ScmChangedFilesProviderTest {
@Test
public void testProviderDoesntSupport() {
when(branchConfiguration.targetBranchName()).thenReturn("target");
- when(branchConfiguration.isShortOrPullRequest()).thenReturn(true);
+ when(branchConfiguration.isPullRequest()).thenReturn(true);
when(scmConfiguration.provider()).thenReturn(scmProvider);
when(scmProvider.branchChangedFiles("target", rootBaseDir)).thenReturn(null);
ScmChangedFiles scmChangedFiles = provider.provide(scmConfiguration, branchConfiguration, project);
@@ -100,7 +100,7 @@ public class ScmChangedFilesProviderTest {
@Test
public void testNoOpInNonShortLivedBranch() {
- when(branchConfiguration.isShortOrPullRequest()).thenReturn(false);
+ when(branchConfiguration.isPullRequest()).thenReturn(false);
ScmChangedFiles scmChangedFiles = provider.provide(scmConfiguration, branchConfiguration, project);
assertThat(scmChangedFiles.get()).isNull();
@@ -117,7 +117,7 @@ public class ScmChangedFilesProviderTest {
};
when(scmConfiguration.provider()).thenReturn(legacy);
- when(branchConfiguration.isShortOrPullRequest()).thenReturn(true);
+ when(branchConfiguration.isPullRequest()).thenReturn(true);
when(branchConfiguration.targetBranchName()).thenReturn("target");
ScmChangedFiles scmChangedFiles = provider.provide(scmConfiguration, branchConfiguration, project);
@@ -129,7 +129,7 @@ public class ScmChangedFilesProviderTest {
@Test
public void testReturnChangedFiles() {
when(branchConfiguration.targetBranchName()).thenReturn("target");
- when(branchConfiguration.isShortOrPullRequest()).thenReturn(true);
+ when(branchConfiguration.isPullRequest()).thenReturn(true);
when(scmConfiguration.provider()).thenReturn(scmProvider);
when(scmProvider.branchChangedFiles("target", rootBaseDir)).thenReturn(Collections.singleton(Paths.get("changedFile").toAbsolutePath()));
ScmChangedFiles scmChangedFiles = provider.provide(scmConfiguration, branchConfiguration, project);
@@ -142,7 +142,7 @@ public class ScmChangedFilesProviderTest {
public void testCacheObject() {
provider.provide(scmConfiguration, branchConfiguration, project);
provider.provide(scmConfiguration, branchConfiguration, project);
- verify(branchConfiguration).isShortOrPullRequest();
+ verify(branchConfiguration).isPullRequest();
}
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/DefaultSensorStorageTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/DefaultSensorStorageTest.java
index 264e666429f..c37b3543b15 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/DefaultSensorStorageTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/DefaultSensorStorageTest.java
@@ -175,7 +175,7 @@ public class DefaultSensorStorageTest {
@Test
public void should_skip_issue_on_short_branch_when_file_status_is_SAME() {
InputFile file = new TestInputFileBuilder("foo", "src/Foo.php").setStatus(InputFile.Status.SAME).build();
- when(branchConfiguration.isShortOrPullRequest()).thenReturn(true);
+ when(branchConfiguration.isPullRequest()).thenReturn(true);
DefaultIssue issue = new DefaultIssue(project).at(new DefaultIssueLocation().on(file));
underTest.store(issue);
@@ -199,7 +199,7 @@ public class DefaultSensorStorageTest {
DefaultInputFile file = new TestInputFileBuilder("foo", "src/Foo.php")
.setContents("// comment")
.setStatus(InputFile.Status.SAME).build();
- when(branchConfiguration.isShortOrPullRequest()).thenReturn(true);
+ when(branchConfiguration.isPullRequest()).thenReturn(true);
DefaultHighlighting highlighting = new DefaultHighlighting(underTest).onFile(file).highlight(0, 1, TypeOfText.KEYWORD);
underTest.store(highlighting);
@@ -225,7 +225,7 @@ public class DefaultSensorStorageTest {
@Test
public void should_not_skip_file_measures_on_short_lived_branch_or_pull_request_when_file_status_is_SAME() {
DefaultInputFile file = new TestInputFileBuilder("foo", "src/Foo.php").setStatus(InputFile.Status.SAME).build();
- when(branchConfiguration.isShortOrPullRequest()).thenReturn(true);
+ when(branchConfiguration.isPullRequest()).thenReturn(true);
underTest.store(new DefaultMeasure()
.on(file)
@@ -243,7 +243,7 @@ public class DefaultSensorStorageTest {
.setStatus(InputFile.Status.SAME)
.setContents("foo")
.build();
- when(branchConfiguration.isShortOrPullRequest()).thenReturn(true);
+ when(branchConfiguration.isPullRequest()).thenReturn(true);
underTest.store(new DefaultSignificantCode()
.onFile(file)
diff --git a/sonar-scanner-protocol/src/main/protobuf/scanner_report.proto b/sonar-scanner-protocol/src/main/protobuf/scanner_report.proto
index 20ad98aea5c..61ab3465982 100644
--- a/sonar-scanner-protocol/src/main/protobuf/scanner_report.proto
+++ b/sonar-scanner-protocol/src/main/protobuf/scanner_report.proto
@@ -70,8 +70,7 @@ message Metadata {
enum BranchType {
UNSET = 0;
- LONG = 1;
- SHORT = 2;
+ BRANCH = 1;
PULL_REQUEST = 3;
}
}
diff --git a/sonar-ws/src/main/protobuf/ws-commons.proto b/sonar-ws/src/main/protobuf/ws-commons.proto
index 442630a7fce..0fd09fd34b3 100644
--- a/sonar-ws/src/main/protobuf/ws-commons.proto
+++ b/sonar-ws/src/main/protobuf/ws-commons.proto
@@ -129,6 +129,7 @@ enum BranchType {
LONG = 1;
SHORT = 2;
PULL_REQUEST = 3;
+ BRANCH = 4;
}
message Organization {