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-1853 Refactor the RoslynSettingsFileSynchronizer to not use ServerIssueStore #6029

Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
19809ca
SLVS-1757 Rename SuppressionIssueStoreUpdater to reflect its new resp…
gabriela-trutan-sonarsource Feb 13, 2025
4020eb9
SLVS-1757 Add new events to the RoslynSuppressionUpdater
gabriela-trutan-sonarsource Feb 13, 2025
ebbb08b
SLVS-1757 Move interface into its own file
gabriela-trutan-sonarsource Feb 13, 2025
5699c59
SLVS-1757 Raise events when issues are suppressed/resolved.
gabriela-trutan-sonarsource Feb 13, 2025
6a18560
SLVS-1757 CaYC: set log context in touched class.
gabriela-trutan-sonarsource Feb 13, 2025
00a248e
SLVS-1757 Rename events and methodds with more speaking names
gabriela-trutan-sonarsource Feb 14, 2025
690389f
SLVS-1757 Fix wrong events invoked caused by name confusion.
gabriela-trutan-sonarsource Feb 14, 2025
c3ffa1f
SLVS-1853 Store the server key of the issue so that the issues can be…
gabriela-trutan-sonarsource Feb 14, 2025
44f16a8
SLVS-1853 Update the suppressions file when SuppressedIssuesReloaded …
gabriela-trutan-sonarsource Feb 14, 2025
2123359
SLVS-1853 Update the suppressions file when NewIssuesSuppressed event…
gabriela-trutan-sonarsource Feb 14, 2025
f92ea61
SLVS-1853 Update the suppressions file when SuppressionsRemoved event…
gabriela-trutan-sonarsource Feb 14, 2025
99ee6ba
SLVS-1853 Remove reference to ServerIssueStore
gabriela-trutan-sonarsource Feb 14, 2025
dd8af86
SLVS-1853 Log when roslyn suppressions file is updated
gabriela-trutan-sonarsource Feb 14, 2025
f9c2467
SLVS-1853 Add thread safety when writing to the RoslynSettingsFileSto…
gabriela-trutan-sonarsource Feb 14, 2025
caec235
SLVS-1853 Fix QG
gabriela-trutan-sonarsource Feb 14, 2025
31e2bba
SLVS-1853 Move class into its own file.
gabriela-trutan-sonarsource Feb 14, 2025
1e4a7c1
SLVS-1853 Use method that provides solutionName instead of calculatin…
gabriela-trutan-sonarsource Feb 14, 2025
de236c9
Merge branch 'feature/sloop-mute-issue' of https://github.com/SonarSo…
gabriela-trutan-sonarsource Feb 14, 2025
3c33b59
Revert "SLVS-1853 Add thread safety when writing to the RoslynSetting…
gabriela-trutan-sonarsource Feb 14, 2025
04ec416
SLVS-1853 Add thread safety when writing to the RoslynSettingsFileSyn…
gabriela-trutan-sonarsource Feb 14, 2025
3d386ac
SLVS-1853 Move logic of Funcs into separate class
gabriela-trutan-sonarsource Feb 14, 2025
bee1d9c
SLVS-1853 Hide hierarchy of SuppressedIssuesCalculators behind an in…
gabriela-trutan-sonarsource Feb 14, 2025
1641725
SLVS-1853 Improve test coverage
gabriela-trutan-sonarsource Feb 14, 2025
1059374
SLVS-1853 Rework after review:
gabriela-trutan-sonarsource Feb 17, 2025
cb81158
SLVS-1853 Use RunOnBackgroundThread
gabriela-trutan-sonarsource Feb 17, 2025
56ac421
SLVS-1853 Fix QG
gabriela-trutan-sonarsource Feb 17, 2025
9d62e09
SLVS-1853 Fix failing tests
gabriela-trutan-sonarsource Feb 17, 2025
870dde5
SLVS-1853 Improve test coverage
gabriela-trutan-sonarsource Feb 17, 2025
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
2 changes: 1 addition & 1 deletion src/ConnectedMode/Suppressions/ISuppressionUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace SonarLint.VisualStudio.ConnectedMode.Suppressions;
/// <summary>
/// Fetches suppressed issues from the server and raises events. This is mainly needed for Roslyn languages
/// </summary>
internal interface ISuppressionUpdater
public interface ISuppressionUpdater
{
/// <summary>
/// Fetches all available suppressions from the server and raises the <see cref="SuppressedIssuesReloaded"/> event.
Expand Down
13 changes: 6 additions & 7 deletions src/Integration.Vsix/SonarLintIntegrationPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Threading;
using SonarLint.VisualStudio.ConnectedMode.UI;
using SonarLint.VisualStudio.Core;
using SonarLint.VisualStudio.Infrastructure.VS;
Expand Down Expand Up @@ -85,9 +84,9 @@ private async Task InitOnUIThreadAsync()

IServiceProvider serviceProvider = this;

this.commandManager = new PackageCommandManager(serviceProvider.GetService<IMenuCommandService>());
commandManager = new PackageCommandManager(serviceProvider.GetService<IMenuCommandService>());

this.commandManager.Initialize(
commandManager.Initialize(
serviceProvider.GetMefService<IProjectPropertyManager>(),
serviceProvider.GetMefService<IOutputWindowService>(),
serviceProvider.GetMefService<IShowInBrowserService>(),
Expand All @@ -96,8 +95,8 @@ private async Task InitOnUIThreadAsync()
serviceProvider.GetMefService<IConnectedModeBindingServices>(),
serviceProvider.GetMefService<IConnectedModeUIManager>());

this.roslynSettingsFileSynchronizer = await this.GetMefServiceAsync<IRoslynSettingsFileSynchronizer>();
roslynSettingsFileSynchronizer.UpdateFileStorageAsync().Forget(); // don't wait for it to finish
// make sure roslynSettingsFileSynchronizer is initialized
roslynSettingsFileSynchronizer = await this.GetMefServiceAsync<IRoslynSettingsFileSynchronizer>();
Debug.Assert(threadHandling.CheckAccess(), "Still expecting to be on the UI thread");

logger.WriteLine(Strings.SL_InitializationComplete);
Expand All @@ -114,8 +113,8 @@ protected override void Dispose(bool disposing)
base.Dispose(disposing);
if (disposing)
{
this.roslynSettingsFileSynchronizer?.Dispose();
this.roslynSettingsFileSynchronizer = null;
roslynSettingsFileSynchronizer?.Dispose();
roslynSettingsFileSynchronizer = null;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SonarLint.VisualStudio.Roslyn.Suppressions.InProcess;
using static SonarLint.VisualStudio.Roslyn.Suppressions.UnitTests.TestHelper;

Expand All @@ -31,12 +29,13 @@ public class IssueConverterTests
[TestMethod]
public void Convert_SimplePropertiesAreHandledCorrectly()
{
var sonarIssue = CreateSonarQubeIssue(hash: "aaaa", filePath: "\\bbb\\ccc\\file.txt");
var sonarIssue = CreateSonarQubeIssue(hash: "aaaa", filePath: "\\bbb\\ccc\\file.txt", issueKey: "key");

var actual = RoslynSettingsFileSynchronizer.IssueConverter.Convert(sonarIssue);
var actual = IssueConverter.Convert(sonarIssue);

actual.Hash.Should().Be("aaaa");
actual.FilePath.Should().Be("\\bbb\\ccc\\file.txt");
actual.IssueServerKey.Should().Be("key");
}

[TestMethod]
Expand All @@ -48,9 +47,9 @@ public void Convert_LineNumbersAreHandledCorrectly(int? sonarLineNumber, int? ex
// 1-based Sonar line numbers should be converted to 0-based Roslyn line numbers
var sonarIssue = CreateSonarQubeIssue(line: sonarLineNumber);

var actual = RoslynSettingsFileSynchronizer.IssueConverter.Convert(sonarIssue);
var actual = IssueConverter.Convert(sonarIssue);

if(expected.HasValue)
if (expected.HasValue)
{
actual.RoslynIssueLine.Value.Should().Be(expected);
}
Expand Down Expand Up @@ -80,7 +79,7 @@ public void Convert_RepoKeysAreHandledCorrectly(string compositeKey, RoslynLangu
{
var sonarIssue = CreateSonarQubeIssue(ruleId: compositeKey);

var actual = RoslynSettingsFileSynchronizer.IssueConverter.Convert(sonarIssue);
var actual = IssueConverter.Convert(sonarIssue);

actual.RoslynLanguage.Should().Be(expectedLanguage);
actual.RoslynRuleId.Should().Be(expectedRuleKey);
Expand Down
Loading