Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLVS-1726 Rename solution to SonarQube.VisualStudio #5911

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .cirrus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ build_task:
SM_CLIENT_CRT: VAULT[development/team/sonarlint/kv/data/codesigning/2023-2025 data.cert]
SM_HOST: VAULT[development/team/sonarlint/kv/data/codesigning/2023-2025 data.host]
SM_KP: key_525594307
SOLUTION_PATH: SonarLint.VisualStudio.Integration.sln
SOLUTION_PATH: SonarQube.VisualStudio.sln
vnaskos-sonar marked this conversation as resolved.
Show resolved Hide resolved
SONAR_TOKEN: VAULT[development/kv/data/sonarcloud data.token]
SONAR_URL: VAULT[development/kv/data/sonarcloud data.url]
SONARSOURCE_SNK_FILE: ${TMP_DIR}\SonarSource.snk
Expand Down Expand Up @@ -90,7 +90,7 @@ build_task:
sbomname="SonarLint.visualstudio.sbom-${PROJECT_VERSION}-2022.json"
gpg --batch --passphrase "$SIGN_PASSPHRASE" --allow-secret-key-import --import <(echo "$SIGN_KEY")
gpg --list-secret-keys
dotnet CycloneDX SonarLint.VisualStudio.Integration.sln -t -j -o binaries
dotnet CycloneDX "${SOLUTION_PATH}" -t -j -o binaries
cd binaries
mv bom.json $sbomname
gpg --pinentry-mode loopback --passphrase "$SIGN_PASSPHRASE" --armor --detach-sig --default-key [email protected] "$sbomname"
Expand Down
2 changes: 1 addition & 1 deletion SonarLint.VsTargetVersion.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
Alternatively, you can explicitly specify the version of VS to target e.g.
msbuild.exe SonarLint.VisualStudio.Integration.sln /p:VsTargetVersion=2022
msbuild.exe SonarQube.VisualStudio.sln /p:VsTargetVersion=2022
The allowed value for VsTargetVersion is 2022.
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/EmbeddedSonarAnalyzer.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<!-- Note: Guide on how to update the analyzers is on the xtranet! -->
<EmbeddedSonarAnalyzerVersion>10.3.0.106239</EmbeddedSonarAnalyzerVersion>
<EmbeddedSonarCFamilyAnalyzerVersion>6.61.0.77816</EmbeddedSonarCFamilyAnalyzerVersion>
<EmbeddedSonarJSAnalyzerVersion>10.18.0.28572</EmbeddedSonarJSAnalyzerVersion>
<EmbeddedSonarJSAnalyzerVersion>10.19.0.29100</EmbeddedSonarJSAnalyzerVersion>
<EmbeddedSonarSecretsJarVersion>2.19.0.4883</EmbeddedSonarSecretsJarVersion>
<!-- SLOOP: Binaries for SonarLint Out Of Process -->
<EmbeddedSloopVersion>10.11.2.79730</EmbeddedSloopVersion>
<EmbeddedSloopVersion>10.12.0.79820</EmbeddedSloopVersion>
</PropertyGroup>
</Project>
37 changes: 19 additions & 18 deletions src/SLCore.UnitTests/SLCoreInstanceHandleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class SLCoreInstanceHandleTests
private const string StorageRoot = "storageRootSl";
private const string WorkDir = "workDirSl";
private const string UserHome = "userHomeSl";

private static readonly ClientConstantsDto ClientConstants = new(default, default, default);
private static readonly FeatureFlagsDto FeatureFlags = new(default, default, default, default, default, default, default, default, default);
private static readonly TelemetryClientConstantAttributesDto TelemetryConstants = new(default, default, default, default, default);
Expand All @@ -53,7 +53,7 @@ public class SLCoreInstanceHandleTests
private static readonly SonarCloudConnectionConfigurationDto SonarCloudConnection = new("sc", true, "https://sonarcloud.io/");

private static readonly BoundServerProject Binding = new("solution", "projectKey", new ServerConnection.SonarQube(new Uri("http://localhost")));

private static readonly List<string> JarList = new() { "jar1" };
private static readonly Dictionary<string, string> ConnectedModeJarList = new() { {"key", "jar1"} };
private ISLCoreRpcFactory slCoreRpcFactory;
Expand Down Expand Up @@ -119,7 +119,7 @@ public void Initialize_SuccessfullyInitializesInCorrectOrder(string nodeJsPath)
nodeLocator.Get().Returns(nodeJsPath);
var telemetryMigrationDto = new TelemetryMigrationDto(default, default, default);
telemetryMigrationProvider.Get().Returns(telemetryMigrationDto);

testSubject.Initialize();

Received.InOrder(() =>
Expand All @@ -139,12 +139,13 @@ public void Initialize_SuccessfullyInitializesInCorrectOrder(string nodeJsPath)
&& parameters.standaloneRuleConfigByKey.Count == 0
&& !parameters.isFocusOnNewCode
&& parameters.telemetryConstantAttributes == TelemetryConstants
&& parameters.languageSpecificRequirements.clientNodeJsPath == nodeJsPath
&& parameters.languageSpecificRequirements.jsTsRequirements.clientNodeJsPath == nodeJsPath
&& parameters.languageSpecificRequirements.jsTsRequirements.bundlePath == null
&& parameters.telemetryMigration == telemetryMigrationDto));
configScopeUpdater.UpdateConfigScopeForCurrentSolution(Binding);
});
}

[TestMethod]
public void Initialize_NoLanguagesAnalysisEnabled_DisablesAllLanguages()
{
Expand All @@ -159,7 +160,7 @@ public void Initialize_NoLanguagesAnalysisEnabled_DisablesAllLanguages()
Language[] expectedDisabledLanguages = [Language.ABAP, Language.APEX, Language.YAML, Language.XML];
initializeParams.disabledPluginKeysForAnalysis.Should().BeEquivalentTo(expectedDisabledLanguages.Select(l => l.GetPluginKey()));
}

[TestMethod]
public void Initialize_AnalysisPartiallyEnabled_DisablesAllNotEnabledLanguages()
{
Expand All @@ -174,7 +175,7 @@ public void Initialize_AnalysisPartiallyEnabled_DisablesAllNotEnabledLanguages()
Language[] expectedDisabledLanguages = [Language.ABAP, Language.XML];
initializeParams.disabledPluginKeysForAnalysis.Should().BeEquivalentTo(expectedDisabledLanguages.Select(l => l.GetPluginKey()));
}

[TestMethod]
public void Initialize_AnalysisFullyEnabled_DisablesNoLanguages()
{
Expand Down Expand Up @@ -212,8 +213,8 @@ public void Dispose_Initialized_ShutsDownAndDisposesRpc()
var serviceProvider = rpc.ServiceProvider;
serviceProvider.ClearReceivedCalls();
testSubject.Dispose();


serviceProvider.Received().TryGetTransientService(out Arg.Any<ILifecycleManagementSLCoreService>());
Received.InOrder(() =>
{
Expand All @@ -224,7 +225,7 @@ public void Dispose_Initialized_ShutsDownAndDisposesRpc()
});
rpc.Received().Dispose();
}

[TestMethod]
public void Dispose_IgnoresServiceProviderException()
{
Expand All @@ -238,12 +239,12 @@ public void Dispose_IgnoresServiceProviderException()
serviceProvider.ClearSubstitute();
serviceProvider.ClearReceivedCalls();
serviceProvider.TryGetTransientService(out Arg.Any<AnySLCoreService>()).Throws(new Exception());

var act = () => testSubject.Dispose();

act.Should().NotThrow();
}

[TestMethod]
public void Dispose_IgnoresShutdownException()
{
Expand All @@ -257,10 +258,10 @@ public void Dispose_IgnoresShutdownException()
var serviceProvider = rpc.ServiceProvider;
serviceProvider.ClearReceivedCalls();
var act = () => testSubject.Dispose();

act.Should().NotThrow();
}

[TestMethod]
public void Dispose_ConnectionDied_DisposesRpc()
{
Expand All @@ -275,7 +276,7 @@ public void Dispose_ConnectionDied_DisposesRpc()
serviceProvider.ClearReceivedCalls();
serviceProvider.TryGetTransientService(out Arg.Any<AnySLCoreService>()).Returns(false);
testSubject.Dispose();

serviceProvider.ReceivedWithAnyArgs().TryGetTransientService(out Arg.Any<ILifecycleManagementSLCoreService>());
rpc.Received().Dispose();
Received.InOrder(() =>
Expand All @@ -286,7 +287,7 @@ public void Dispose_ConnectionDied_DisposesRpc()
});
lifecycleManagement.DidNotReceive().Shutdown();
}

[TestMethod]
public void Dispose_NotInitialized_DoesNothing()
{
Expand All @@ -303,7 +304,7 @@ private void SetUpSuccessfulInitialization(out ILifecycleManagementSLCoreService
constantsProvider.ClientConstants.Returns(ClientConstants);
constantsProvider.FeatureFlags.Returns(FeatureFlags);
constantsProvider.TelemetryConstants.Returns(TelemetryConstants);

foldersProvider.GetWorkFolders().Returns(new SLCoreFolders(StorageRoot, WorkDir, UserHome));
connectionsProvider.GetServerConnections().Returns(new Dictionary<string, ServerConnectionConfiguration>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ [new SonarCloudConnectionConfigurationDto("con2", false, "organization1")],
false,
new TelemetryClientConstantAttributesDto("TESTkey", "TESTname", "TESTversion", "TESTde", new Dictionary<string, object>{{"telemetryObj", new {field = 10}}}),
new TelemetryMigrationDto(true, new DateTimeOffset(2024, 07, 30, 14, 46, 28, TimeSpan.FromHours(1)), 123),
new LanguageSpecificRequirements("node")
new LanguageSpecificRequirements(new JsTsRequirementsDto("node", "bundlePath"))
);

const string expectedString = """
Expand Down Expand Up @@ -142,7 +142,10 @@ [new SonarCloudConnectionConfigurationDto("con2", false, "organization1")],
"numUseDays": 123
},
"languageSpecificRequirements": {
"clientNodeJsPath": "node"
"jsTsRequirements": {
"clientNodeJsPath": "node",
"bundlePath": "bundlePath"
}
}
}
""";
Expand Down
7 changes: 3 additions & 4 deletions src/SLCore/ISLCoreInstanceHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
using SonarLint.VisualStudio.SLCore.Service.Connection.Models;
using SonarLint.VisualStudio.SLCore.Service.Lifecycle;
using SonarLint.VisualStudio.SLCore.Service.Lifecycle.Models;
using SonarLint.VisualStudio.SLCore.Service.Rules.Models;
using SonarLint.VisualStudio.SLCore.State;

namespace SonarLint.VisualStudio.SLCore;
Expand Down Expand Up @@ -114,11 +113,11 @@ public void Initialize()
isFocusOnNewCode: false,
constantsProvider.TelemetryConstants,
telemetryMigrationProvider.Get(),
new LanguageSpecificRequirements(nodeLocator.Get())));
new LanguageSpecificRequirements(new JsTsRequirementsDto(nodeLocator.Get(), null))));

configScopeUpdater.UpdateConfigScopeForCurrentSolution(activeSolutionBoundTracker.CurrentConfiguration.Project);
}

public void Dispose()
{
Shutdown();
Expand All @@ -144,6 +143,6 @@ private void Shutdown()
{
// ignore
}

}
}
23 changes: 23 additions & 0 deletions src/SLCore/Service/Lifecycle/Models/JsTsRequirementsDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* SonarLint for Visual Studio
* Copyright (C) 2016-2024 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.
*/

namespace SonarLint.VisualStudio.SLCore.Service.Lifecycle.Models;

public record JsTsRequirementsDto(string clientNodeJsPath, string bundlePath);
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

namespace SonarLint.VisualStudio.SLCore.Service.Lifecycle.Models;

public record LanguageSpecificRequirements(string clientNodeJsPath)
public record LanguageSpecificRequirements(JsTsRequirementsDto jsTsRequirements)
{
[ExcludeFromCodeCoverage]
private object omnisharpRequirements => null; // org.sonarsource.sonarlint.core.rpc.protocol.backend.initialize.OmnisharpRequirementsDto
Expand Down
2 changes: 1 addition & 1 deletion tools/CleanRebuild.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
(for %%a in ("%~dp0..\src\Integration.Vsix\lib" "%LOCALAPPDATA%\SLVS_Build_DownloadedJars" "%LOCALAPPDATA%\SLVS_CFamily_Build" "%LOCALAPPDATA%\SLVS_TypeScript_Build" "%LOCALAPPDATA%\SLVS_Build_SLOOP" "%LOCALAPPDATA%\SLVS_Build_Dotnet") do rd /s /q "%%~a")

call msbuild.exe %~dp0..\build\DownloadDependencies -t:Rebuild
call msbuild.exe "%~dp0..\SonarLint.VisualStudio.Integration.sln" -t:Rebuild
call msbuild.exe "%~dp0..\SonarQube.VisualStudio.sln" -t:Rebuild