Documentation
¶
Index ¶
- Variables
- func GenerateCodebaseID(language, relativePath string) string
- func ParseCodebaseID(id string) (language, path string, err error)
- type CodebaseInfo
- type Options
- type Sources
- type Unpacker
- func (unpacker *Unpacker) Extract(sources Sources) ([]*sbom.NodeList, error)
- func (unpacker *Unpacker) ExtractArtifact(path string) (*sbom.NodeList, error)
- func (unpacker *Unpacker) ExtractArtifactWithContext(ctx context.Context, path string) (*sbom.NodeList, error)
- func (unpacker *Unpacker) ExtractCodebase(path string) (*sbom.NodeList, error)
- func (unpacker *Unpacker) ExtractCodebaseWithContext(ctx context.Context, path string) (*sbom.NodeList, error)
- func (unpacker *Unpacker) ExtractSBOM(ctx context.Context, r io.ReadSeeker) (*sbom.NodeList, error)
- func (unpacker *Unpacker) ExtractSBOMFromFile(path string) (*sbom.NodeList, error)
- func (unpacker *Unpacker) ExtractWithContext(ctx context.Context, sources Sources) ([]*sbom.NodeList, error)
- func (unpacker *Unpacker) ListCodebases(ctx context.Context, path string) ([]CodebaseInfo, error)
- func (unpacker *Unpacker) RegisterDecomposer(d api.Decomposer)
- func (unpacker *Unpacker) UnregisterDecomposer(d api.Decomposer)
Constants ¶
This section is empty.
Variables ¶
var DefaultOptions = Options{ FailOnSingleMulti: true, ReadGitVersion: true, UseGitIgnore: true, IndexFiles: false, // contains filtered or unexported fields }
var ErrMultipleCodebases = errors.New("multiple codebases found")
Functions ¶
func GenerateCodebaseID ¶
GenerateCodebaseID creates a codebase ID from language and relative path.
func ParseCodebaseID ¶
ParseCodebaseID parses a codebase ID into its language and path components.
Types ¶
type CodebaseInfo ¶
type CodebaseInfo struct {
ID string // e.g., "golang:./services/api"
Language string // e.g., "golang", "rust"
Path string // Relative path from input directory
AbsPath string // Absolute filesystem path
}
CodebaseInfo contains information about a discovered codebase.
type Options ¶
type Options struct {
// FailOnSingleMulti makes Unpacker return an error on calls that return a
// single nodelist but obtain more than one from the configured decomposers.
// This can happen when a directory contains code for more than one language
// or multiple projects in the same directory.
//
// By default this is on as turning it off causes unpacker to behave in a
// non-deterministic way as it can return different data depending on the
// order of the configured decomposers
FailOnSingleMulti bool
// IndexFiles instructs the unpacker to add all files to the resulting
// nodelist after running source decomposers in a directory. This runs
// the file decomposer indexer which will hash all files in the source
// directory.
IndexFiles bool
// ReadGitVersion instructs the unpacker to read the current version from
// the git history and pass it to the decomposers to use as the version
// for the root nodes.
ReadGitVersion bool
// IgnorePatterns are additional paths to ignore (in addition to thise in .gitignore)
IgnorePatterns []string
// UseGitIgnore instructs the unpacker to use load patterns from the gitignore
// file when available .
UseGitIgnore bool
// CodebaseFilter filters to a specific codebase by ID (e.g., "golang:./services/api").
// If empty, all codebases are included.
CodebaseFilter string
// contains filtered or unexported fields
}
type Unpacker ¶
type Unpacker struct {
Options Options
// contains filtered or unexported fields
}
Unpacker is the main tool to extract dependency data
func NewUnpacker ¶
func NewUnpacker() *Unpacker
func (*Unpacker) ExtractArtifact ¶
ExtractFromCodeBaseWithContext
func (*Unpacker) ExtractArtifactWithContext ¶
func (unpacker *Unpacker) ExtractArtifactWithContext(ctx context.Context, path string) (*sbom.NodeList, error)
ExtractCodeBaseWithContext extracts data from a single directory.
func (*Unpacker) ExtractCodebase ¶
ExtractFromCodeBaseWithContext
func (*Unpacker) ExtractCodebaseWithContext ¶
func (unpacker *Unpacker) ExtractCodebaseWithContext(ctx context.Context, path string) (*sbom.NodeList, error)
ExtractCodeBaseWithContext extracts data from a single directory.
func (*Unpacker) ExtractSBOM ¶
ExtractFromCodeBaseWithContext
func (*Unpacker) ExtractSBOMFromFile ¶
ExtractFromCodeBaseWithContext
func (*Unpacker) ExtractWithContext ¶
func (unpacker *Unpacker) ExtractWithContext(ctx context.Context, sources Sources) ([]*sbom.NodeList, error)
ExtractWithContext launches the analyzers in the configured sources and returns resulting nodelists.
func (*Unpacker) ListCodebases ¶
ListCodebases discovers and lists all codebases found in the given path.
func (*Unpacker) RegisterDecomposer ¶
func (unpacker *Unpacker) RegisterDecomposer(d api.Decomposer)
func (*Unpacker) UnregisterDecomposer ¶
func (unpacker *Unpacker) UnregisterDecomposer(d api.Decomposer)