From c33d259f60267672547271bd0be6308856ac2f54 Mon Sep 17 00:00:00 2001 From: AlvoBen Date: Thu, 5 Dec 2024 11:19:00 +0200 Subject: [PATCH] Refactor scan model response variable assignment Simplified the retrieval of config and engines by using a single variable, `scanModelResponse`, to improve code readability and maintainability. This change consolidates access to elements of `allScansModel.Scans[0]` into one clear reference point, making the code easier to understand and modify in the future. --- internal/commands/scan.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/commands/scan.go b/internal/commands/scan.go index 163d724b3..2664c89e5 100644 --- a/internal/commands/scan.go +++ b/internal/commands/scan.go @@ -847,8 +847,9 @@ func getResubmitConfiguration(scansWrapper wrappers.ScansWrapper, projectID, use } if len(allScansModel.Scans) > 0 { - config = allScansModel.Scans[0].Metadata.Configs - engines := allScansModel.Scans[0].Engines + scanModelResponse := allScansModel.Scans[0] + config = scanModelResponse.Metadata.Configs + engines := scanModelResponse.Engines // Check if there are no scan types sent using the flags, and use the latest scan engine types if userScanTypes == "" { actualScanTypes = strings.Join(engines, ",")