Skip to content

Commit

Permalink
Update SLCORE version (git blaming improvements)
Browse files Browse the repository at this point in the history
  • Loading branch information
sophio-japharidze-sonarsource committed Feb 25, 2025
1 parent 7d993eb commit 3a4034e
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<properties>
<jdk.min.version>17</jdk.min.version>
<sonarlint.core.version>10.15.0.80289</sonarlint.core.version>
<sonarlint.core.version>10.16.0.80351</sonarlint.core.version>
<!-- Version used by Xodus -->
<kotlin.version>1.6.10</kotlin.version>
<!-- analyzers used for tests -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import org.sonarsource.sonarlint.core.rpc.protocol.backend.connection.validate.ValidateConnectionParams;
import org.sonarsource.sonarlint.core.rpc.protocol.client.log.LogLevel;
import org.sonarsource.sonarlint.core.rpc.protocol.common.Either;
import org.sonarsource.sonarlint.core.serverapi.EndpointParams;
import org.sonarsource.sonarlint.core.serverconnection.DownloadException;
import org.sonarsource.sonarlint.ls.ForcedAnalysisCoordinator;
import org.sonarsource.sonarlint.ls.SonarLintExtendedLanguageClient;
Expand All @@ -58,6 +57,7 @@
import org.sonarsource.sonarlint.ls.folders.WorkspaceFoldersManager;
import org.sonarsource.sonarlint.ls.log.LanguageClientLogger;
import org.sonarsource.sonarlint.ls.notebooks.OpenNotebooksCache;
import org.sonarsource.sonarlint.ls.settings.EndpointParams;
import org.sonarsource.sonarlint.ls.settings.ServerConnectionSettings;
import org.sonarsource.sonarlint.ls.settings.SettingsManager;
import org.sonarsource.sonarlint.ls.settings.WorkspaceFolderSettings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class TaintIssue extends TaintVulnerabilityDto {
public TaintIssue(TaintVulnerabilityDto taintDto, String workspaceFolderUri, boolean isSonarCloud) {
super(taintDto.getId(), taintDto.getSonarServerKey(), taintDto.isResolved(), taintDto.getRuleKey(), taintDto.getMessage(),
taintDto.getIdeFilePath(), taintDto.getIntroductionDate(), taintDto.getSeverityMode(), taintDto.getFlows(), taintDto.getTextRange(),
taintDto.getRuleDescriptionContextKey(), taintDto.isOnNewCode());
taintDto.getRuleDescriptionContextKey(), taintDto.isOnNewCode(), false);
this.workspaceFolderUri = workspaceFolderUri;
this.source = isSonarCloud ? SONARCLOUD_TAINT_SOURCE : SONARQUBE_TAINT_SOURCE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@
package org.sonarsource.sonarlint.ls.notebooks;

import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.sonarsource.sonarlint.core.rpc.protocol.backend.rules.ImpactDto;
import org.sonarsource.sonarlint.core.rpc.protocol.client.issue.QuickFixDto;
import org.sonarsource.sonarlint.core.rpc.protocol.client.issue.RaisedFindingDto;
import org.sonarsource.sonarlint.core.rpc.protocol.client.issue.RaisedIssueDto;
Expand Down Expand Up @@ -73,13 +71,9 @@ public Integer getEndLineOffset() {
}

public RaisedIssueDto getIssue() {
var severity = issue.getSeverityMode().isLeft() ? issue.getSeverityMode().getLeft().getSeverity() : null;
var type = issue.getSeverityMode().isLeft() ? issue.getSeverityMode().getLeft().getType() : null;
var cleanCodeAttribute = issue.getSeverityMode().isRight() ? issue.getSeverityMode().getRight().getCleanCodeAttribute() : null;
var impacts = issue.getSeverityMode().isRight() ? issue.getSeverityMode().getRight().getImpacts() : new ArrayList<ImpactDto>();
return new RaisedIssueDto(issue.getId(), issue.getServerKey(), issue.getRuleKey(), issue.getPrimaryMessage(),
issue.getSeverityMode(), issue.getIntroductionDate(),
issue.isOnNewCode(), issue.isResolved(), cellTextRange, issue.getFlows(), cellQuickFixes, issue.getRuleDescriptionContextKey());
issue.isOnNewCode(), issue.isResolved(), cellTextRange, issue.getFlows(), cellQuickFixes, issue.getRuleDescriptionContextKey(), false);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* SonarLint Language Server
* Copyright (C) 2009-2025 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.sonarsource.sonarlint.ls.settings;

import javax.annotation.Nullable;

public record EndpointParams(String baseUrl, boolean sonarCloud, @Nullable String organization) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.sonarsource.sonarlint.core.rpc.protocol.common.Either;
import org.sonarsource.sonarlint.core.rpc.protocol.common.SonarCloudRegion;
import org.sonarsource.sonarlint.core.rpc.protocol.common.TokenDto;
import org.sonarsource.sonarlint.core.serverapi.EndpointParams;

@Immutable
public class ServerConnectionSettings {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -970,14 +970,14 @@ private TaintVulnerabilityDto getTaintDto(UUID uuid) {
return new TaintVulnerabilityDto(uuid, "serverKey", false, "ruleKey", "message",
Path.of("filePath"), Instant.now(), org.sonarsource.sonarlint.core.rpc.protocol.common.Either
.forLeft(new StandardModeDetails(IssueSeverity.MAJOR, RuleType.BUG)), List.of(),
new TextRangeWithHashDto(5, 5, 5, 5, ""), "", true);
new TextRangeWithHashDto(5, 5, 5, 5, ""), "", true, false);
}

private TaintIssue getTaintIssue(UUID uuid) {
return new TaintIssue(new TaintVulnerabilityDto(uuid, "serverKey", false, "ruleKey", "message",
Path.of("filePath"), Instant.now(), org.sonarsource.sonarlint.core.rpc.protocol.common.Either
.forLeft(new StandardModeDetails(IssueSeverity.MAJOR, RuleType.BUG)), List.of(),
new TextRangeWithHashDto(5, 5, 5, 5, ""), "", true), "folderUri", true);
new TextRangeWithHashDto(5, 5, 5, 5, ""), "", true, false), "folderUri", true);
}

public class DummyCancelChecker implements CancelChecker {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ void shouldInitializeWithCorrectSeverityDetails() {
List.of(),
null,
"ruleDescriptionContextKey",
false,
false);

var taintIssue = new TaintIssue(taintIssueDto, "workspaceFolderUri", true);
Expand All @@ -91,6 +92,7 @@ void shouldInitializeWithCorrectSeverityDetailsMQR() {
List.of(),
null,
"ruleDescriptionContextKey",
false,
false);

var taintIssue = new TaintIssue(taintIssueDto, "workspaceFolderUri", true);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* SonarLint Language Server
* Copyright (C) 2009-2025 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.sonarsource.sonarlint.ls.notebooks;

import java.net.URI;
import java.time.Instant;
import java.util.List;
import java.util.UUID;
import org.junit.jupiter.api.Test;
import org.sonarsource.sonarlint.core.rpc.protocol.client.issue.RaisedIssueDto;
import org.sonarsource.sonarlint.core.rpc.protocol.common.Either;
import org.sonarsource.sonarlint.core.rpc.protocol.common.IssueSeverity;
import org.sonarsource.sonarlint.core.rpc.protocol.common.RuleType;
import org.sonarsource.sonarlint.core.rpc.protocol.common.StandardModeDetails;

import static org.assertj.core.api.AssertionsForClassTypes.assertThat;

class DelegatingCellIssueTest {
@Test
void shouldGetIssue() {
var id = UUID.randomUUID();
var finding = new RaisedIssueDto(
id,
null,
"ruleKey",
"message",
Either.forLeft(new StandardModeDetails(IssueSeverity.BLOCKER, RuleType.BUG)),
Instant.now(),
true,
false,
null,
List.of(),
List.of(),
null,
false
);
var cellIssue = new DelegatingCellIssue(finding, URI.create("/my/workspace"), null, List.of());

var issue = cellIssue.getIssue();

assertThat(issue.getId()).isEqualTo(id);
assertThat(issue.getRuleKey()).isEqualTo("ruleKey");
assertThat(issue.getPrimaryMessage()).isEqualTo("message");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,8 @@ private void manuallyReindexCellLines(VersionedOpenNotebook underTest) {
new TextRangeDto(1, 0, 1, 0),
List.of(),
List.of(),
null
null,
false
);
underTest.toCellIssue(new DelegatingIssue(fakeFindingDto, URI.create("")));
}
Expand Down

0 comments on commit 3a4034e

Please sign in to comment.