From a9eaa7428dede2a895be63935c2e8aa268ab8328 Mon Sep 17 00:00:00 2001 From: Georgii Borovinskikh Date: Tue, 21 Nov 2023 10:13:37 +0100 Subject: [PATCH] Add transition issue method to SQ client, rename IssueTransition to match the convention --- src/SonarQube.Client/ISonarQubeService.cs | 6 ++++++ .../{IssueTransition.cs => SonarQubeIssueTransition.cs} | 2 +- src/SonarQube.Client/SonarQubeService.cs | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) rename src/SonarQube.Client/Models/{IssueTransition.cs => SonarQubeIssueTransition.cs} (96%) diff --git a/src/SonarQube.Client/ISonarQubeService.cs b/src/SonarQube.Client/ISonarQubeService.cs index 30b46b7d77..fd93a6f476 100644 --- a/src/SonarQube.Client/ISonarQubeService.cs +++ b/src/SonarQube.Client/ISonarQubeService.cs @@ -148,5 +148,11 @@ Task> GetNotificationEventsAsync(string projectKey, Task CreateSSEStreamReader(string projectKey, CancellationToken token); Task> SearchHotspotsAsync(string projectKey, string branch, CancellationToken token); + + /// + /// Sets review status for an issue and adds an optional comment. + /// See api/issues/do_transition and api/issues/add_comment + /// + Task TransitionIssue(string issueKey, SonarQubeIssueTransition transition, string optionalComment, CancellationToken token); } } diff --git a/src/SonarQube.Client/Models/IssueTransition.cs b/src/SonarQube.Client/Models/SonarQubeIssueTransition.cs similarity index 96% rename from src/SonarQube.Client/Models/IssueTransition.cs rename to src/SonarQube.Client/Models/SonarQubeIssueTransition.cs index cc1064e507..072cebf39b 100644 --- a/src/SonarQube.Client/Models/IssueTransition.cs +++ b/src/SonarQube.Client/Models/SonarQubeIssueTransition.cs @@ -23,7 +23,7 @@ namespace SonarQube.Client.Models /// /// Supported values for parameter `transition` of api/issues/do_transition /// - public enum IssueTransition + public enum SonarQubeIssueTransition { FalsePositive, WontFix, diff --git a/src/SonarQube.Client/SonarQubeService.cs b/src/SonarQube.Client/SonarQubeService.cs index 763d8043d5..fa1732eaec 100644 --- a/src/SonarQube.Client/SonarQubeService.cs +++ b/src/SonarQube.Client/SonarQubeService.cs @@ -391,6 +391,12 @@ public async Task> SearchHotspotsAsync(string proj }, token); + public Task TransitionIssue(string issueKey, SonarQubeIssueTransition transition, string optionalComment, CancellationToken token) + { + // no-op, will be implemented later + return Task.CompletedTask; + } + public async Task> GetTaintVulnerabilitiesAsync(string projectKey, string branch, CancellationToken token) { var issues = await InvokeCheckedRequestAsync(