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

Conversation

gabriela-trutan-sonarsource
Copy link
Contributor

@gabriela-trutan-sonarsource gabriela-trutan-sonarsource commented Feb 14, 2025

SLVS-1853

The ServerIssuesStore will be dropped, so the RoslynSettingsFileSynchronizer should listen to the events from SuppressionIssueStoreUpdater and should update the file accordingly.

As part of this PR, I have stored the server key of the issue in the file as well, so that the issues can be easier to identify when they are resolved.

This targets the PR in which the SuppressionIssueStoreUpdater has been refactored to use events.

The ServerIssuesStore will be dropped, so instead an event should be raised.
When an issue is resolved on the server, it means it is suppressed. And when isResolved=false, it means the issue is reopened (a.k.a. suppression has to be removed)
… easier to identify when they are resolved.

When an issue is resolved, we receive from the server a list of issueKeys, which makes it difficult to retrieve the corresponding SonarQubeIssue in the RoslynSuppressionUpdater due to the fact that the GetSuppressedIssuesAsync will not return the issue if it is not suppressed (it is resolved)

Additionally there is no need to perform yet another server request if we already have the information about the issue Key so we could simply cache it.
Base automatically changed from gt/suppressions-updater to feature/sloop-mute-issue February 14, 2025 15:33
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments about code organization

IEnumerable<SuppressedIssue> GetSuppressedIssuesOrNull(string roslynSettingsKey);
}

internal interface ISuppressedIssuesCalculatorFactory

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to change this now, it's good enough, but I thought of a cleaner (IMO) alternative:

interface ISuppressedIssuesCalculator<T>
{
    IEnumerable<SuppressedIssue> GetSuppressedIssuesOrNull(string roslynSettingsKey, T payload);
} 

class ConcreteCalculator1<EventType1>

The slight problem with this is the fact that All and New calculators have essentially the same payload type, so there would be a need to have a way to differentiate between them somehow

- Extract method
- Move class into its own file
-Split tests into multiple test classes
@gabriela-trutan-sonarsource gabriela-trutan-sonarsource merged commit 58de500 into feature/sloop-mute-issue Feb 17, 2025
3 checks passed
@gabriela-trutan-sonarsource gabriela-trutan-sonarsource deleted the gt/roslyn-settings-file-sync branch February 17, 2025 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants