workspace

package
v0.0.0-...-28ae1cc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Set

func Set(w *Workspace)

Types

type Folder

type Folder struct {
	// contains filtered or unexported fields
}

Folder contains files that can be scanned, it orchestrates snyk scans and provides a caching layer to avoid unnecessary computing

func NewFolder

func NewFolder(
	c *config.Config,
	path string,
	name string,
	scanner snyk.Scanner,
	hoverService hover.Service,
	scanNotifier snyk.ScanNotifier,
	notifier noti.Notifier,
) *Folder

func (*Folder) Clear

func (f *Folder) Clear()

func (*Folder) ClearDiagnosticsByIssueType

func (f *Folder) ClearDiagnosticsByIssueType(removedType product.FilterableIssueType)

func (*Folder) ClearIssues

func (f *Folder) ClearIssues(path string)

func (*Folder) Contains

func (f *Folder) Contains(path string) bool

func (*Folder) FilterAndPublishDiagnostics

func (f *Folder) FilterAndPublishDiagnostics(p *product.Product)

func (*Folder) FilterIssues

func (f *Folder) FilterIssues(issues snyk.IssuesByFile, supportedIssueTypes map[product.FilterableIssueType]bool) snyk.
	IssuesByFile

func (*Folder) IsProviderFor

func (f *Folder) IsProviderFor(_ product.FilterableIssueType) bool

func (*Folder) IsScanned

func (f *Folder) IsScanned() bool

func (*Folder) IsTrusted

func (f *Folder) IsTrusted() bool

func (*Folder) Issue

func (f *Folder) Issue(key string) snyk.Issue

func (*Folder) Issues

func (f *Folder) Issues() snyk.IssuesByFile

func (*Folder) IssuesByProduct

func (f *Folder) IssuesByProduct() snyk.ProductIssuesByFile

func (*Folder) IssuesForFile

func (f *Folder) IssuesForFile(file string) []snyk.Issue

func (*Folder) IssuesForRange

func (f *Folder) IssuesForRange(filePath string, requestedRange snyk.Range) (matchingIssues []snyk.Issue)

func (*Folder) Name

func (f *Folder) Name() string

func (*Folder) Path

func (f *Folder) Path() string

func (*Folder) RegisterCacheRemovalHandler

func (f *Folder) RegisterCacheRemovalHandler(handler func(path string))

func (*Folder) ScanFile

func (f *Folder) ScanFile(ctx context.Context, path string)

func (*Folder) ScanFolder

func (f *Folder) ScanFolder(ctx context.Context)

func (*Folder) SetStatus

func (f *Folder) SetStatus(status FolderStatus)

func (*Folder) Status

func (f *Folder) Status() FolderStatus

type FolderStatus

type FolderStatus int
const (
	Unscanned FolderStatus = iota
	Scanned   FolderStatus = iota
)

type Workspace

type Workspace struct {
	// contains filtered or unexported fields
}

Workspace represents the highest entity in an IDE that contains code. A workspace may contain multiple folders

func Get

func Get() *Workspace

todo can we move to di?

func New

func New(
	c *config.Config,
	instrumentor performance.Instrumentor,
	scanner snyk.Scanner,
	hoverService hover.Service,
	scanNotifier snyk.ScanNotifier,
	notifier noti.Notifier,
) *Workspace

func (*Workspace) AddFolder

func (w *Workspace) AddFolder(f *Folder)

func (*Workspace) ChangeWorkspaceFolders

func (w *Workspace) ChangeWorkspaceFolders(ctx context.Context, params lsp.DidChangeWorkspaceFoldersParams)

ChangeWorkspaceFolders clears the "Removed" folders, adds the "New" folders, and starts an automatic scan if auto-scans are enabled.

func (*Workspace) Clear

func (w *Workspace) Clear()

func (*Workspace) ClearIssuesByType

func (w *Workspace) ClearIssuesByType(removedType product.FilterableIssueType)

func (*Workspace) DeleteFile

func (w *Workspace) DeleteFile(filePath string)

func (*Workspace) EndRequestTrustCommunication

func (w *Workspace) EndRequestTrustCommunication()

func (*Workspace) Folders

func (w *Workspace) Folders() (folder []*Folder)

func (*Workspace) GetFolderContaining

func (w *Workspace) GetFolderContaining(path string) (folder *Folder)

func (*Workspace) GetFolderTrust

func (w *Workspace) GetFolderTrust() (trusted []*Folder, untrusted []*Folder)

func (*Workspace) IsTrustRequestOngoing

func (w *Workspace) IsTrustRequestOngoing() bool

func (*Workspace) Issue

func (w *Workspace) Issue(key string) snyk.Issue

func (*Workspace) Issues

func (w *Workspace) Issues() snyk.IssuesByFile

func (*Workspace) IssuesForFile

func (w *Workspace) IssuesForFile(path string) []snyk.Issue

func (*Workspace) IssuesForRange

func (w *Workspace) IssuesForRange(path string, r snyk.Range) []snyk.Issue

func (*Workspace) RemoveFolder

func (w *Workspace) RemoveFolder(folderPath string)

func (*Workspace) ScanWorkspace

func (w *Workspace) ScanWorkspace(ctx context.Context)

func (*Workspace) StartRequestTrustCommunication

func (w *Workspace) StartRequestTrustCommunication()

func (*Workspace) TrustFoldersAndScan

func (w *Workspace) TrustFoldersAndScan(ctx context.Context, foldersToBeTrusted []*Folder)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL