Skip to content

Commit

Permalink
feat: add new folder config field to configure pre/post scan commands
Browse files Browse the repository at this point in the history
  • Loading branch information
bastiandoetsch committed Jan 30, 2025
1 parent 48d0dca commit 21497fe
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions internal/types/lsp.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,15 +528,28 @@ type WorkspaceFoldersChangeEvent struct {
Removed []WorkspaceFolder `json:"Removed,omitempty"`
}

// ScanCommandConfig allows to define a command that is run before (PreScanCommand)
// or after (PostScanCommand) a scan. It will only be run for the
// referenceFolder / referenceScan (in case of delta) if the corresponding
// parameter PreScanOnlyReferenceFolder / PostScanOnlyReferenceFolder is set.
// Else it will run for all scans.
type ScanCommandConfig struct {
PreScanCommand string `json:"command,omitempty"`
PreScanOnlyReferenceFolder bool `json:"preScanOnlyReferenceFolder,omitempty"`
PostScanCommand string `json:"postScanCommand,omitempty"`
PostScanOnlyReferenceFolder bool `json:"postScanOnlyReferenceFolder,omitempty"`
}

// FolderConfig is exchanged between IDE and LS
// IDE sends this as part of the settings/initialization
// LS sends this via the $/snyk.folderConfig notification
type FolderConfig struct {
FolderPath string `json:"folderPath"`
BaseBranch string `json:"baseBranch"`
LocalBranches []string `json:"localBranches,omitempty"`
AdditionalParameters []string `json:"additionalParameters,omitempty"`
ReferenceFolderPath string `json:"referenceFolderPath,omitempty"`
FolderPath string `json:"folderPath"`
BaseBranch string `json:"baseBranch"`
LocalBranches []string `json:"localBranches,omitempty"`
AdditionalParameters []string `json:"additionalParameters,omitempty"`
ReferenceFolderPath string `json:"referenceFolderPath,omitempty"`
ScanCommandConfig ScanCommandConfig `json:"scanCommandConfig,omitempty"`
}

type Pair struct {
Expand Down

0 comments on commit 21497fe

Please sign in to comment.