Documentation
¶
Index ¶
- type BazelOptions
- type CommaSeparatedString
- type GlobalOptions
- type GradleOptions
- type OnGraphFunc
- type PythonOptions
- type ResolverMetadata
- type SCAPlugin
- type SCAPluginOptions
- func (o *SCAPluginOptions) WithAllProjects(allProjects bool) *SCAPluginOptions
- func (o *SCAPluginOptions) WithAllowOutOfSync(allowOutOfSync bool) *SCAPluginOptions
- func (o *SCAPluginOptions) WithBazelGo(b bool) *SCAPluginOptions
- func (o *SCAPluginOptions) WithBazelJvm(b bool) *SCAPluginOptions
- func (o *SCAPluginOptions) WithBazelMaxTargets(n int) *SCAPluginOptions
- func (o *SCAPluginOptions) WithBazelTargetQuery(query string) *SCAPluginOptions
- func (o *SCAPluginOptions) WithExclude(exclude []string) *SCAPluginOptions
- func (o *SCAPluginOptions) WithExcludePaths(excludePaths []string) *SCAPluginOptions
- func (o *SCAPluginOptions) WithFailFast(failFast bool) *SCAPluginOptions
- func (o *SCAPluginOptions) WithForceIncludeWorkspacePackages(forceIncludeWorkspacePackages bool) *SCAPluginOptions
- func (o *SCAPluginOptions) WithForceSingleGraph(forceSingleGraph bool) *SCAPluginOptions
- func (o *SCAPluginOptions) WithGradleAllSubProjects(all bool) *SCAPluginOptions
- func (o *SCAPluginOptions) WithGradleConfigurationAttributes(attributes string) *SCAPluginOptions
- func (o *SCAPluginOptions) WithGradleConfigurationMatching(pattern string) *SCAPluginOptions
- func (o *SCAPluginOptions) WithGradleInitScript(initScript string) *SCAPluginOptions
- func (o *SCAPluginOptions) WithGradleNormalizeDeps(normalizeDeps bool) *SCAPluginOptions
- func (o *SCAPluginOptions) WithGradleSkipWrapper(skipWrapper bool) *SCAPluginOptions
- func (o *SCAPluginOptions) WithGradleSubProject(subProject string) *SCAPluginOptions
- func (o *SCAPluginOptions) WithIncludeDev(includeDev bool) *SCAPluginOptions
- func (o *SCAPluginOptions) WithIncludeProvenance(includeProvenance bool) *SCAPluginOptions
- func (o *SCAPluginOptions) WithNoBuildIsolation(noBuildIsolation bool) *SCAPluginOptions
- func (o *SCAPluginOptions) WithProjectName(projectName string) *SCAPluginOptions
- func (o *SCAPluginOptions) WithRawFlags(rawflags string) *SCAPluginOptions
- func (o *SCAPluginOptions) WithTargetFile(targetFile string) *SCAPluginOptions
- func (o *SCAPluginOptions) WithWorkspacePackage(pkg string) *SCAPluginOptions
- type SCAResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BazelOptions ¶
type BazelOptions struct {
TargetQuery string `arg:"--bazel-target-query"`
MaxTargets *int `arg:"--bazel-max-targets"`
Jvm bool `arg:"--bazel-jvm"`
Go bool `arg:"--bazel-go"`
}
BazelOptions contains Bazel-specific options for dependency graph generation.
type CommaSeparatedString ¶
type CommaSeparatedString []string
CommaSeparatedString is a custom type that parses comma-separated values.
func (*CommaSeparatedString) UnmarshalText ¶
func (c *CommaSeparatedString) UnmarshalText(text []byte) error
UnmarshalText implements encoding.TextUnmarshaler.
type GlobalOptions ¶
type GlobalOptions struct {
TargetFile *string `arg:"--target-file"`
AllProjects bool `arg:"--all-projects"`
IncludeDev bool `arg:"--dev,-d"`
Exclude CommaSeparatedString `arg:"--exclude"`
ExcludePaths CommaSeparatedString `arg:"--exclude-paths"`
FailFast bool `arg:"--fail-fast"`
AllowOutOfSync bool // Derived from --strict-out-of-sync (inverted); parsed in NewPluginOptionsFromRawFlags.
ForceSingleGraph bool `arg:"--force-single-graph"`
ForceIncludeWorkspacePackages bool `arg:"--internal-uv-workspace-packages"`
ProjectName *string `arg:"--project-name"`
IncludeProvenance bool `arg:"--include-provenance"`
WorkspacePackage *string `arg:"--workspace-package"`
RawFlags []string
}
GlobalOptions contains options that apply globally across all SCA plugins.
type GradleOptions ¶
type GradleOptions struct {
// ConfigurationMatching is a regex to select only matching Gradle configurations.
ConfigurationMatching string `arg:"--configuration-matching"`
// ConfigurationAttributes filters configurations by attribute values (key:value,key:value).
ConfigurationAttributes string `arg:"--configuration-attributes"`
// SubProject restricts scanning to a single named Gradle sub-project.
// Accepts both --gradle-sub-project and --sub-project (legacy alias).
SubProject string `arg:"--gradle-sub-project,--sub-project"`
// AllSubProjects scans all sub-projects in a multi-project build.
AllSubProjects bool `arg:"--all-sub-projects"`
// InitScript overrides the built-in init script with a user-supplied path.
InitScript string `arg:"--init-script"`
// SkipWrapper bypasses gradlew discovery and forces use of the gradle command.
SkipWrapper bool `arg:"--gradle-skip-wrapper"`
// NormalizeDeps uses the SHAs of the dependencies provided by the IncludeProvenance flag
// to lookup the canonical GAV coordinates of the dependency and rewrite the produced DepGraphs.
NormalizeDeps bool `arg:"--gradle-normalize-deps"`
}
GradleOptions contains Gradle-specific options for dependency graph generation.
type OnGraphFunc ¶
OnGraphFunc is the per-graph callback BuildDepGraphsFromDir invokes for each emitted SCAResult. See SCAPlugin for the contract.
type PythonOptions ¶
type PythonOptions struct {
NoBuildIsolation bool `arg:"--no-build-isolation"`
}
PythonOptions contains Python-specific options for dependency graph generation.
type ResolverMetadata ¶
type SCAPlugin ¶
type SCAPlugin interface {
BuildDepGraphsFromDir(
ctx context.Context,
log logger.Logger,
dir string,
options *SCAPluginOptions,
onGraph OnGraphFunc,
) error
GetName() string
}
SCAPlugin builds dependency graphs from a directory containing project files. Results are emitted one at a time via onGraph as the plugin produces them — there is no aggregated return value. This lets consumers stream graphs to disk / network without holding the full set in memory.
onGraph is invoked exactly once per produced SCAResult. Calls are serialized — onGraph need not be goroutine-safe. A non-nil onGraph return aborts the run and BuildDepGraphsFromDir returns that error to the caller.
Setup-time failures (cannot access dir, options invalid, etc.) are returned directly from BuildDepGraphsFromDir without ever invoking onGraph. Per-graph build failures are emitted as SCAResult{Descriptor: ..., Error: err} via onGraph — the run continues so the caller sees every project the plugin attempted.
type SCAPluginOptions ¶
type SCAPluginOptions struct {
Global GlobalOptions
Python PythonOptions
Gradle GradleOptions
Bazel BazelOptions
}
SCAPluginOptions contains configuration options for SCA plugins, including global settings and language-specific options.
func NewPluginOptions ¶
func NewPluginOptions() *SCAPluginOptions
func NewPluginOptionsFromRawFlags ¶
func NewPluginOptionsFromRawFlags(rawFlags []string) (*SCAPluginOptions, error)
func (*SCAPluginOptions) WithAllProjects ¶
func (o *SCAPluginOptions) WithAllProjects(allProjects bool) *SCAPluginOptions
func (*SCAPluginOptions) WithAllowOutOfSync ¶
func (o *SCAPluginOptions) WithAllowOutOfSync(allowOutOfSync bool) *SCAPluginOptions
func (*SCAPluginOptions) WithBazelGo ¶
func (o *SCAPluginOptions) WithBazelGo(b bool) *SCAPluginOptions
WithBazelGo sets whether the Bazel Go dep-graph scanner should run.
func (*SCAPluginOptions) WithBazelJvm ¶
func (o *SCAPluginOptions) WithBazelJvm(b bool) *SCAPluginOptions
WithBazelJvm sets whether the Bazel JVM dep-graph scanner should run.
func (*SCAPluginOptions) WithBazelMaxTargets ¶
func (o *SCAPluginOptions) WithBazelMaxTargets(n int) *SCAPluginOptions
WithBazelMaxTargets caps the number of Bazel targets the resolver will process. 0 disables the ceiling. Not calling this leaves the plugin's safe default in place.
func (*SCAPluginOptions) WithBazelTargetQuery ¶
func (o *SCAPluginOptions) WithBazelTargetQuery(query string) *SCAPluginOptions
WithBazelTargetQuery sets the Bazel query used for target discovery (empty = plugin default).
func (*SCAPluginOptions) WithExclude ¶
func (o *SCAPluginOptions) WithExclude(exclude []string) *SCAPluginOptions
func (*SCAPluginOptions) WithExcludePaths ¶
func (o *SCAPluginOptions) WithExcludePaths(excludePaths []string) *SCAPluginOptions
func (*SCAPluginOptions) WithFailFast ¶
func (o *SCAPluginOptions) WithFailFast(failFast bool) *SCAPluginOptions
func (*SCAPluginOptions) WithForceIncludeWorkspacePackages ¶
func (o *SCAPluginOptions) WithForceIncludeWorkspacePackages(forceIncludeWorkspacePackages bool) *SCAPluginOptions
func (*SCAPluginOptions) WithForceSingleGraph ¶
func (o *SCAPluginOptions) WithForceSingleGraph(forceSingleGraph bool) *SCAPluginOptions
func (*SCAPluginOptions) WithGradleAllSubProjects ¶
func (o *SCAPluginOptions) WithGradleAllSubProjects(all bool) *SCAPluginOptions
func (*SCAPluginOptions) WithGradleConfigurationAttributes ¶
func (o *SCAPluginOptions) WithGradleConfigurationAttributes(attributes string) *SCAPluginOptions
func (*SCAPluginOptions) WithGradleConfigurationMatching ¶
func (o *SCAPluginOptions) WithGradleConfigurationMatching(pattern string) *SCAPluginOptions
func (*SCAPluginOptions) WithGradleInitScript ¶
func (o *SCAPluginOptions) WithGradleInitScript(initScript string) *SCAPluginOptions
func (*SCAPluginOptions) WithGradleNormalizeDeps ¶
func (o *SCAPluginOptions) WithGradleNormalizeDeps(normalizeDeps bool) *SCAPluginOptions
func (*SCAPluginOptions) WithGradleSkipWrapper ¶
func (o *SCAPluginOptions) WithGradleSkipWrapper(skipWrapper bool) *SCAPluginOptions
func (*SCAPluginOptions) WithGradleSubProject ¶
func (o *SCAPluginOptions) WithGradleSubProject(subProject string) *SCAPluginOptions
func (*SCAPluginOptions) WithIncludeDev ¶
func (o *SCAPluginOptions) WithIncludeDev(includeDev bool) *SCAPluginOptions
func (*SCAPluginOptions) WithIncludeProvenance ¶
func (o *SCAPluginOptions) WithIncludeProvenance(includeProvenance bool) *SCAPluginOptions
func (*SCAPluginOptions) WithNoBuildIsolation ¶
func (o *SCAPluginOptions) WithNoBuildIsolation(noBuildIsolation bool) *SCAPluginOptions
func (*SCAPluginOptions) WithProjectName ¶
func (o *SCAPluginOptions) WithProjectName(projectName string) *SCAPluginOptions
func (*SCAPluginOptions) WithRawFlags ¶
func (o *SCAPluginOptions) WithRawFlags(rawflags string) *SCAPluginOptions
func (*SCAPluginOptions) WithTargetFile ¶
func (o *SCAPluginOptions) WithTargetFile(targetFile string) *SCAPluginOptions
func (*SCAPluginOptions) WithWorkspacePackage ¶ added in v2.2.0
func (o *SCAPluginOptions) WithWorkspacePackage(pkg string) *SCAPluginOptions
type SCAResult ¶
type SCAResult struct {
DepGraph *depgraph.DepGraph `json:"depGraph,omitempty"`
ProjectDescriptor identity.ProjectDescriptor `json:"projectDescriptor"`
ResolverMetadata *ResolverMetadata `json:"meta,omitempty"`
ProcessedFiles []string `json:"processedFiles,omitempty"`
Error error `json:"error,omitempty"`
}
SCAResult represents one Software Composition Analysis result — either a successfully-built dep-graph for one project, or an error surfaced against the project's descriptor.
ProcessedFiles lists the files this result was derived from (lockfile + any manifests consulted). Per-graph attribution; if a consumer wants a deduped union across all results, it computes it itself.
Directories
¶
| Path | Synopsis |
|---|---|
|
javascript
|
|
|
python
|
|
|
Package scatest provides shared helpers for SCAPlugin tests across pkg/ecosystems/* — chiefly Run, which drives a plugin's BuildDepGraphsFromDir and returns every emitted SCAResult as a slice for the test body to inspect.
|
Package scatest provides shared helpers for SCAPlugin tests across pkg/ecosystems/* — chiefly Run, which drives a plugin's BuildDepGraphsFromDir and returns every emitted SCAResult as a slice for the test body to inspect. |