From 56642734ede01d607890e094e4fc880a744f4a0a Mon Sep 17 00:00:00 2001 From: Sam Smith Date: Tue, 20 Jun 2023 22:13:29 -0400 Subject: [PATCH] code cleanup --- src/DevOpsMetrics.Cmd/ServiceApiClient.cs | 6 +++--- src/DevOpsMetrics.Function/AzureAlertProcessor.cs | 1 - src/DevOpsMetrics.Function/NightlyProcessor.cs | 2 +- src/DevOpsMetrics.Function/ServiceApiClient.cs | 7 +++---- .../Controllers/SettingsController.cs | 2 +- src/DevOpsMetrics.Tests/Service/TableStorageDATests.cs | 2 +- src/DevOpsMetrics.Web/Controllers/HomeController.cs | 3 --- 7 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/DevOpsMetrics.Cmd/ServiceApiClient.cs b/src/DevOpsMetrics.Cmd/ServiceApiClient.cs index e34d691d..f847f08f 100644 --- a/src/DevOpsMetrics.Cmd/ServiceApiClient.cs +++ b/src/DevOpsMetrics.Cmd/ServiceApiClient.cs @@ -35,9 +35,9 @@ public async Task> GetGitHubSettings() } public async Task UpdateDORASummaryItem( - string owner, string project, string repository, - string branch, string workflowName, string workflowId, - string resourceGroup, int numberOfDays, int maxNumberOfItems, + string owner, string project, string repository, + string branch, string workflowName, string workflowId, + string resourceGroup, int numberOfDays, int maxNumberOfItems, bool isGitHub = true) { string url = $"/api/DORASummary/UpdateDORASummaryItem?owner={owner}&project={project}&repository={repository}&branch={branch}&workflowName={workflowName}&workflowId={workflowId}&resourceGroup={resourceGroup}&numberOfDays={numberOfDays}&maxNumberOfItems={maxNumberOfItems}&log=&useCache=true&isGitHub={isGitHub}"; diff --git a/src/DevOpsMetrics.Function/AzureAlertProcessor.cs b/src/DevOpsMetrics.Function/AzureAlertProcessor.cs index b9342447..c0fdd849 100644 --- a/src/DevOpsMetrics.Function/AzureAlertProcessor.cs +++ b/src/DevOpsMetrics.Function/AzureAlertProcessor.cs @@ -1,7 +1,6 @@ using System.IO; using System.Reflection; using System.Threading.Tasks; -using DevOpsMetrics.Core.DataAccess.TableStorage; using DevOpsMetrics.Core.Models.Common; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; diff --git a/src/DevOpsMetrics.Function/NightlyProcessor.cs b/src/DevOpsMetrics.Function/NightlyProcessor.cs index 07c55e8e..dd09ee7b 100644 --- a/src/DevOpsMetrics.Function/NightlyProcessor.cs +++ b/src/DevOpsMetrics.Function/NightlyProcessor.cs @@ -57,7 +57,7 @@ public static async Task Run( { log.LogInformation($"Processing Azure DevOps organization {azSetting.Organization}, project {azSetting.Project}"); ProcessingResult ghResult = await serviceApiClient.UpdateDORASummaryItem( - azSetting.Organization, azSetting.Project, azSetting.Repository, + azSetting.Organization, azSetting.Project, azSetting.Repository, azSetting.Branch, azSetting.BuildName, azSetting.BuildId, azSetting.ProductionResourceGroup, numberOfDays, maxNumberOfItems, false); diff --git a/src/DevOpsMetrics.Function/ServiceApiClient.cs b/src/DevOpsMetrics.Function/ServiceApiClient.cs index 2bea3472..aaac5fbe 100644 --- a/src/DevOpsMetrics.Function/ServiceApiClient.cs +++ b/src/DevOpsMetrics.Function/ServiceApiClient.cs @@ -8,7 +8,6 @@ using DevOpsMetrics.Core.Models.Common; using DevOpsMetrics.Core.Models.GitHub; using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Logging; using Newtonsoft.Json; namespace DevOpsMetrics.Function @@ -40,9 +39,9 @@ public async Task> GetGitHubSettings() } public async Task UpdateDORASummaryItem( - string owner, string project, string repository, - string branch, string workflowName, string workflowId, - string resourceGroup, int numberOfDays, int maxNumberOfItems, + string owner, string project, string repository, + string branch, string workflowName, string workflowId, + string resourceGroup, int numberOfDays, int maxNumberOfItems, bool isGitHub = true) { string url = $"/api/DORASummary/UpdateDORASummaryItem?owner={owner}&project={project}&repository={repository}&branch={branch}&workflowName={workflowName}&workflowId={workflowId}&resourceGroup={resourceGroup}&numberOfDays={numberOfDays}&maxNumberOfItems={maxNumberOfItems}&log=&useCache=true&isGitHub={isGitHub}"; diff --git a/src/DevOpsMetrics.Service/Controllers/SettingsController.cs b/src/DevOpsMetrics.Service/Controllers/SettingsController.cs index 7f9cd46d..d4429fb6 100644 --- a/src/DevOpsMetrics.Service/Controllers/SettingsController.cs +++ b/src/DevOpsMetrics.Service/Controllers/SettingsController.cs @@ -119,7 +119,7 @@ public async Task UpdateAzureDevOpsProjectLog(string organization, string } [HttpGet("GetGitHubProjectLog")] - public async Task< List> GetGitHubProjectLog(string owner, string repo) + public async Task> GetGitHubProjectLog(string owner, string repo) { string partitionKey = PartitionKeys.CreateGitHubSettingsPartitionKey(owner, repo); diff --git a/src/DevOpsMetrics.Tests/Service/TableStorageDATests.cs b/src/DevOpsMetrics.Tests/Service/TableStorageDATests.cs index 579a94da..52a6237f 100644 --- a/src/DevOpsMetrics.Tests/Service/TableStorageDATests.cs +++ b/src/DevOpsMetrics.Tests/Service/TableStorageDATests.cs @@ -107,7 +107,7 @@ public async Task AzGetPRCommitsDAIntegrationTest() { AzureDevOpsPR pullRequest = JsonConvert.DeserializeObject(item.ToString()); string pullRequestId = pullRequest.PullRequestId; - JArray list =await da.GetTableStorageItemsFromStorage(tableStorageConfig, tableStorageConfig.TableAzureDevOpsPRCommits, PartitionKeys.CreateAzureDevOpsPRCommitPartitionKey(organization, project, pullRequestId)); + JArray list = await da.GetTableStorageItemsFromStorage(tableStorageConfig, tableStorageConfig.TableAzureDevOpsPRCommits, PartitionKeys.CreateAzureDevOpsPRCommitPartitionKey(organization, project, pullRequestId)); if (list.Count > 0) { itemsAdded = list.Count; diff --git a/src/DevOpsMetrics.Web/Controllers/HomeController.cs b/src/DevOpsMetrics.Web/Controllers/HomeController.cs index 7ece4295..a1b22869 100644 --- a/src/DevOpsMetrics.Web/Controllers/HomeController.cs +++ b/src/DevOpsMetrics.Web/Controllers/HomeController.cs @@ -7,14 +7,11 @@ using DevOpsMetrics.Core.Models.AzureDevOps; using DevOpsMetrics.Core.Models.Common; using DevOpsMetrics.Core.Models.GitHub; -using DevOpsMetrics.Service.Controllers; using DevOpsMetrics.Web.Models; using DevOpsMetrics.Web.Services; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; -using Microsoft.CodeAnalysis; using Microsoft.Extensions.Configuration; -using NuGet.Protocol; namespace DevOpsMetrics.Web.Controllers {