Skip to content

Commit 21497fe

Browse files
feat: add new folder config field to configure pre/post scan commands
1 parent 48d0dca commit 21497fe

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

internal/types/lsp.go

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -528,15 +528,28 @@ type WorkspaceFoldersChangeEvent struct {
528528
Removed []WorkspaceFolder `json:"Removed,omitempty"`
529529
}
530530

531+
// ScanCommandConfig allows to define a command that is run before (PreScanCommand)
532+
// or after (PostScanCommand) a scan. It will only be run for the
533+
// referenceFolder / referenceScan (in case of delta) if the corresponding
534+
// parameter PreScanOnlyReferenceFolder / PostScanOnlyReferenceFolder is set.
535+
// Else it will run for all scans.
536+
type ScanCommandConfig struct {
537+
PreScanCommand string `json:"command,omitempty"`
538+
PreScanOnlyReferenceFolder bool `json:"preScanOnlyReferenceFolder,omitempty"`
539+
PostScanCommand string `json:"postScanCommand,omitempty"`
540+
PostScanOnlyReferenceFolder bool `json:"postScanOnlyReferenceFolder,omitempty"`
541+
}
542+
531543
// FolderConfig is exchanged between IDE and LS
532544
// IDE sends this as part of the settings/initialization
533545
// LS sends this via the $/snyk.folderConfig notification
534546
type FolderConfig struct {
535-
FolderPath string `json:"folderPath"`
536-
BaseBranch string `json:"baseBranch"`
537-
LocalBranches []string `json:"localBranches,omitempty"`
538-
AdditionalParameters []string `json:"additionalParameters,omitempty"`
539-
ReferenceFolderPath string `json:"referenceFolderPath,omitempty"`
547+
FolderPath string `json:"folderPath"`
548+
BaseBranch string `json:"baseBranch"`
549+
LocalBranches []string `json:"localBranches,omitempty"`
550+
AdditionalParameters []string `json:"additionalParameters,omitempty"`
551+
ReferenceFolderPath string `json:"referenceFolderPath,omitempty"`
552+
ScanCommandConfig ScanCommandConfig `json:"scanCommandConfig,omitempty"`
540553
}
541554

542555
type Pair struct {

0 commit comments

Comments
 (0)