-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support scs engine In scan create Resubmit command (AST-63906) #840
Conversation
Policy Management Violations
No New Or Fixed Issues Found |
…Checkmarx/ast-cli into Itay/support-SCS-in-scan-create
internal/commands/scan.go
Outdated
SCSMapConfig := make(map[string]interface{}) | ||
SCSConfig := wrappers.SCSConfig{} | ||
SCSMapConfig[resultsMapType] = commonParams.MicroEnginesType // scs is still microengines in the scans API | ||
userScanTypes, _ := cmd.Flags().GetString(commonParams.ScanTypes) | ||
SCSRepoToken, _ := cmd.Flags().GetString(commonParams.SCSRepoTokenFlag) | ||
SCSRepoURL, _ := cmd.Flags().GetString(commonParams.SCSRepoURLFlag) | ||
SCSEngines, _ := cmd.Flags().GetString(commonParams.SCSEnginesFlag) | ||
if resubmitConfig != nil { | ||
for _, config := range resubmitConfig { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract this scope to a new method - createSCSResubmitConfig(...).
This will make the function more readable and will answer the Single Responsibility Principle.
Also, it will probably fix your lint error
internal/commands/scan_test.go
Outdated
result, _ := addSCSScan(cmdCommand, resubmitConfig) | ||
|
||
expectedConfig := wrappers.SCSConfig{ | ||
Twoms: "true", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trueString
internal/commands/scan_test.go
Outdated
{ | ||
Type: commonParams.ScsType, | ||
Value: map[string]interface{}{ | ||
configTwoms: "true", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trueString
internal/commands/scan_test.go
Outdated
{ | ||
Type: commonParams.ScsType, | ||
Value: map[string]interface{}{ | ||
configTwoms: "true", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trueString
Great job! |
if resubmitConfig != nil { | ||
scsConfig = createResubmitConfig(resubmitConfig, scsRepoToken, scsRepoURL) | ||
SCSMapConfig[resultsMapValue] = &scsConfig | ||
return SCSMapConfig, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont you need the config builder to finish his work first?
func createResubmitConfig(resubmitConfig []wrappers.Config, scsRepoToken, scsRepoURL string) wrappers.SCSConfig { | ||
scsConfig := wrappers.SCSConfig{} | ||
for _, config := range resubmitConfig { | ||
resubmitTwoms := config.Value[configTwoms] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the difference between the regular config building and resubmit? Can't we re-use the regular build config?
By submitting a PR to this repository, you agree to the terms within the Checkmarx Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.
Description
References
Testing
Checklist