Skip to content

Commit fe2b6b9

Browse files
committed
Fixed more sonarcube issues
1 parent 7aefc0a commit fe2b6b9

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/Microsoft.OpenApi.Hidi/OpenApiService.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,8 @@ private static async Task<ApiDependency> FindApiDependency(string apiManifestPat
134134
{
135135
apiManifest = ApiManifestDocument.Load(JsonDocument.Parse(fileStream).RootElement);
136136
}
137-
if (apiDependencyName != null)
138-
{
139-
apiDependency = apiManifest.ApiDependencies[apiDependencyName];
140-
}
141-
else
142-
{
143-
apiDependency = apiManifest.ApiDependencies.First().Value;
144-
}
137+
138+
apiDependency = apiDependencyName != null ? apiManifest.ApiDependencies[apiDependencyName] : apiManifest.ApiDependencies.First().Value;
145139
}
146140

147141
return apiDependency;
@@ -284,9 +278,8 @@ private static async Task<OpenApiDocument> GetOpenApi(string openapi, string csd
284278
private static Dictionary<string, List<string>> GetRequestUrlsFromManifest(ApiDependency apiDependency, OpenApiDocument document)
285279
{
286280
// Get the request URLs from the API Dependencies in the API manifest that have a baseURL that matches the server URL in the OpenAPI document
287-
var serversUrls = document.Servers.Select(s => s.Url);
288281
var requests = apiDependency
289-
.Requests.Where(r => r.Exclude == false)
282+
.Requests.Where(r => !r.Exclude)
290283
.Select(r=> new { UriTemplate= r.UriTemplate, Method=r.Method } )
291284
.GroupBy(r => r.UriTemplate)
292285
.ToDictionary(g => g.Key, g => g.Select(r => r.Method).ToList());
@@ -745,7 +738,7 @@ internal async static Task PluginManifest(HidiOptions options, ILogger<OpenApiSe
745738
// Write OpenAIPluginManifest to Output folder
746739
var manifestFile = new FileInfo(Path.Combine(options.OutputFolder,"ai-plugin.json"));
747740
using var file = new FileStream(manifestFile.FullName, FileMode.Create);
748-
var jsonWriter = new Utf8JsonWriter(file, new JsonWriterOptions { Indented = true });
741+
using var jsonWriter = new Utf8JsonWriter(file, new JsonWriterOptions { Indented = true });
749742
manifest.Write(jsonWriter);
750743
jsonWriter.Flush();
751744
}

0 commit comments

Comments
 (0)