Skip to content

Commit

Permalink
fix cyclomatic complexity error
Browse files Browse the repository at this point in the history
  • Loading branch information
Korjen97 committed Aug 20, 2024
1 parent 7babb9a commit 9f7cbbb
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions internal/commands/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,22 @@ func addAPISecScan(cmd *cobra.Command) map[string]interface{} {
}
return nil
}
func processResubmitConfig(SCSConfig *wrappers.SCSConfig, resubmitConfig []wrappers.Config, SCSRepoToken, SCSRepoURL string) {

Check failure on line 977 in internal/commands/scan.go

View workflow job for this annotation

GitHub Actions / lint

captLocal: `SCSConfig' should not be capitalized (gocritic)
for _, config := range resubmitConfig {
resubmitTwoms := config.Value[configTwoms]
if resubmitTwoms != nil {
SCSConfig.Twoms = resubmitTwoms.(string)
}
SCSConfig.RepoURL = SCSRepoURL
SCSConfig.RepoToken = SCSRepoToken
resubmitScoreCard := config.Value[ScsScoreCardType]
if resubmitScoreCard == trueString && SCSRepoToken != "" && SCSRepoURL != "" {
SCSConfig.Scorecard = trueString
} else {
SCSConfig.Scorecard = falseString
}
}
}

func addSCSScan(cmd *cobra.Command, resubmitConfig []wrappers.Config) (map[string]interface{}, error) {
if scanTypeEnabled(commonParams.ScsType) || scanTypeEnabled(commonParams.MicroEnginesType) {
Expand All @@ -985,20 +1001,7 @@ func addSCSScan(cmd *cobra.Command, resubmitConfig []wrappers.Config) (map[strin
SCSRepoURL, _ := cmd.Flags().GetString(commonParams.SCSRepoURLFlag)
SCSEngines, _ := cmd.Flags().GetString(commonParams.SCSEnginesFlag)
if resubmitConfig != nil {
for _, config := range resubmitConfig {
resubmitTwoms := config.Value[configTwoms]
if resubmitTwoms != nil {
SCSConfig.Twoms = resubmitTwoms.(string)
}
SCSConfig.RepoURL = SCSRepoURL
SCSConfig.RepoToken = SCSRepoToken
resubmitScoreCard := config.Value[ScsScoreCardType]
if resubmitScoreCard == trueString && SCSRepoToken != "" && SCSRepoURL != "" {
SCSConfig.Scorecard = trueString
} else {
SCSConfig.Scorecard = falseString
}
}
processResubmitConfig(&SCSConfig, resubmitConfig, SCSRepoToken, SCSRepoURL)
SCSMapConfig[resultsMapValue] = &SCSConfig
return SCSMapConfig, nil
}
Expand Down

0 comments on commit 9f7cbbb

Please sign in to comment.