Skip to content

Commit 50b039a

Browse files
Update to released SLCORE
1 parent 135b0db commit 50b039a

File tree

7 files changed

+1
-172
lines changed

7 files changed

+1
-172
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
<properties>
2626
<jdk.min.version>17</jdk.min.version>
27-
<sonarlint.core.version>10.23.0.81260</sonarlint.core.version>
27+
<sonarlint.core.version>10.23.0.81306</sonarlint.core.version>
2828
<slf4j.version>2.0.17</slf4j.version>
2929
<!-- Version used by Xodus -->
3030
<kotlin.version>1.6.10</kotlin.version>

src/main/java/org/sonarsource/sonarlint/ls/clientapi/SonarLintVSCodeClient.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
import org.jetbrains.annotations.NotNull;
5858
import org.sonarsource.sonarlint.core.commons.HotspotReviewStatus;
5959
import org.sonarsource.sonarlint.core.commons.SonarLintUserHome;
60-
import org.sonarsource.sonarlint.core.rpc.client.ConfigScopeNotFoundException;
6160
import org.sonarsource.sonarlint.core.rpc.client.SonarLintCancelChecker;
6261
import org.sonarsource.sonarlint.core.rpc.client.SonarLintRpcClientDelegate;
6362
import org.sonarsource.sonarlint.core.rpc.protocol.backend.config.binding.BindingSuggestionDto;
@@ -395,11 +394,6 @@ public String matchSonarProjectBranch(String configurationScopeId, String mainBr
395394
return branchManager.matchSonarProjectBranch(configurationScopeId, mainBranchName, allBranchesNames, cancelChecker);
396395
}
397396

398-
@Override
399-
public boolean matchProjectBranch(String configurationScopeId, String branchNameToMatch, SonarLintCancelChecker cancelChecker) throws ConfigScopeNotFoundException {
400-
return branchManager.matchProjectBranch(configurationScopeId, branchNameToMatch, cancelChecker);
401-
}
402-
403397
@Override
404398
public void didChangeMatchedSonarProjectBranch(String configScopeId, String newMatchedBranchName) {
405399
client.setReferenceBranchNameForFolder(SonarLintExtendedLanguageClient.ReferenceBranchForFolder.of(configScopeId,

src/main/java/org/sonarsource/sonarlint/ls/folders/WorkspaceFolderBranchManager.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,4 @@ public String matchSonarProjectBranch(String folderUri, String mainBranchName, S
7272
}
7373
return electedBranchName;
7474
}
75-
76-
public boolean matchProjectBranch(String folderUri, String branchNameToMatch, SonarLintCancelChecker cancelChecker) {
77-
if (cancelChecker.isCanceled()) return false;
78-
return GitUtils.isCurrentBranch(folderUri, branchNameToMatch, logOutput);
79-
}
8075
}

src/main/java/org/sonarsource/sonarlint/ls/util/GitUtils.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
package org.sonarsource.sonarlint.ls.util;
2121

2222
import java.io.IOException;
23-
import java.net.URI;
2423
import java.nio.file.Path;
25-
import java.nio.file.Paths;
2624
import java.util.HashMap;
2725
import java.util.HashSet;
2826
import java.util.Map;
@@ -111,19 +109,6 @@ public static String electBestMatchingServerBranchForCurrentHead(Repository repo
111109
}
112110
}
113111

114-
public static boolean isCurrentBranch(String folderUri, String expectedBranch, LanguageClientLogger logOutput) {
115-
var repo = GitUtils.getRepositoryForDir(Paths.get(URI.create(folderUri)), logOutput);
116-
if (repo == null) {
117-
return false;
118-
}
119-
try {
120-
var branch = repo.getBranch();
121-
return branch != null && branch.equals(expectedBranch);
122-
} catch (IOException e) {
123-
return false;
124-
}
125-
}
126-
127112
private static int distance(Repository repository, Ref from, Ref to) throws IOException {
128113

129114
try (var walk = new RevWalk(repository)) {

src/test/java/org/sonarsource/sonarlint/ls/clientapi/SonarLintVSCodeClientTests.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@
6262
import org.mockito.ArgumentCaptor;
6363
import org.mockito.Captor;
6464
import org.mockito.junit.jupiter.MockitoExtension;
65-
import org.sonarsource.sonarlint.core.rpc.client.ConfigScopeNotFoundException;
66-
import org.sonarsource.sonarlint.core.rpc.client.SonarLintCancelChecker;
6765
import org.sonarsource.sonarlint.core.rpc.protocol.backend.config.binding.BindingSuggestionDto;
6866
import org.sonarsource.sonarlint.core.rpc.protocol.backend.tracking.ListAllResponse;
6967
import org.sonarsource.sonarlint.core.rpc.protocol.backend.tracking.TaintVulnerabilityDto;
@@ -900,25 +898,6 @@ void shouldForwardShowFixSuggestionRequestToClient_windows() {
900898
assertThat(argumentCaptor.getValue().textEdits().get(1).before()).isEqualTo("System.out.println(\"Hello, World!\");");
901899
}
902900

903-
@Test
904-
void shouldMatchProjectBranch() throws ConfigScopeNotFoundException {
905-
var configScopeId = "file:///Users/sonarlint-user/project/";
906-
var projectBranch = "currentBranch";
907-
908-
ArgumentCaptor<String> configScopeIdCaptor = ArgumentCaptor.forClass(String.class);
909-
ArgumentCaptor<String> projectBranchCaptor = ArgumentCaptor.forClass(String.class);
910-
ArgumentCaptor<SonarLintCancelChecker> cancelCheckerArgumentCaptor = ArgumentCaptor.forClass(SonarLintCancelChecker.class);
911-
912-
SonarLintCancelChecker cancelChecker = new SonarLintCancelChecker(new DummyCancelChecker());
913-
underTest.matchProjectBranch(configScopeId, projectBranch,
914-
cancelChecker);
915-
916-
verify(branchManager).matchProjectBranch(configScopeIdCaptor.capture(), projectBranchCaptor.capture(), cancelCheckerArgumentCaptor.capture());
917-
assertThat(configScopeIdCaptor.getValue()).isEqualTo(configScopeId);
918-
assertThat(projectBranchCaptor.getValue()).isEqualTo(projectBranch);
919-
assertThat(cancelCheckerArgumentCaptor.getValue()).isEqualTo(cancelChecker);
920-
}
921-
922901
@Test
923902
@DisabledOnOs(OS.WINDOWS)
924903
void shouldReturnBaseDir() {

src/test/java/org/sonarsource/sonarlint/ls/folders/WorkspaceFolderBranchManagerTest.java

Lines changed: 0 additions & 97 deletions
This file was deleted.

src/test/java/org/sonarsource/sonarlint/ls/util/GitUtilsTests.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -137,33 +137,6 @@ void shouldReturnNullOnException() throws IOException {
137137
assertThat(branch).isNull();
138138
}
139139

140-
@Test
141-
void isCurrentBranch_shouldReturnTrueWhenCurrentBranch(@TempDir File projectDir) {
142-
javaUnzip("closest-branch.zip", projectDir);
143-
Path path = Paths.get(projectDir.getPath(), "closest-branch");
144-
145-
boolean isCurrentBranch = GitUtils.isCurrentBranch(path.toUri().toString(), "current_branch", fakeClientLogger);
146-
assertThat(isCurrentBranch).isTrue();
147-
}
148-
149-
@Test
150-
void isCurrentBranch_shouldReturnFalseWhenNotCurrentBranch(@TempDir File projectDir) {
151-
javaUnzip("closest-branch.zip", projectDir);
152-
Path path = Paths.get(projectDir.getPath(), "closest-branch");
153-
154-
boolean isCurrentBranch = GitUtils.isCurrentBranch(path.toUri().toString(), "not_current_branch", fakeClientLogger);
155-
assertThat(isCurrentBranch).isFalse();
156-
}
157-
158-
@Test
159-
void isCurrentBranch_shouldReturnFalseWhenNoRepo(@TempDir File projectDir) {
160-
javaUnzip("closest-branch.zip", projectDir);
161-
Path path = Paths.get(projectDir.getPath(), "non-existent");
162-
163-
boolean isCurrentBranch = GitUtils.isCurrentBranch(path.toUri().toString(), "not_current_branch", fakeClientLogger);
164-
assertThat(isCurrentBranch).isFalse();
165-
}
166-
167140
@Test
168141
void shouldFavorCurrentBranchIfMultipleCandidates(@TempDir File projectDir) {
169142
// Both main and same-as-master branches are pointing to HEAD, but same-as-master is the currently checked out branch

0 commit comments

Comments
 (0)