dag_builder

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AggregateChecks

func AggregateChecks(ctx context.Context, dag *executiondag.DAG[dag_impl.Input]) ([]checks.Output, error)

func BuildCheckCategoryMap

func BuildCheckCategoryMap(builder DagBuilder) map[string][]category.RiskCategory

func BuildDag

func BuildDag(dag *executiondag.DAG[dag_impl.Input], input *dag_impl.Input, languages map[string]language.Language, artifactFetcher artifactfetcher.Fetcher, ctx context.Context)

BuildDag adds language-specific package registry nodes to the DAG. This includes: - fetcher: Fetches raw package data from language registries - transformer: Transforms raw data into standardized package metadata - version_transformer: Transforms raw data into version history metadata

Parameters: - dag: The DAG to add nodes to - input: The input containing source URL and packages - languages: Map of ecosystem name to Language implementation

Behavior: - If input has SourceURL: fetcher depends on package_detector - If input has packages but no SourceURL: fetcher has no git dependency - Both transformer and version_transformer depend on fetcher (run in parallel)

func BuildGitDag

func BuildGitDag(dag *executiondag.DAG[dag_impl.Input], input dag_impl.Input, ctx context.Context) error

func CollectEntries

func CollectEntries(ctx context.Context, dag *executiondag.DAG[dag_impl.Input], input dag_impl.Input) []executiondag.Entry

CollectEntries collects entries from executed nodes in the DAG. For outputs implementing Persistable, creates an Entry with PersistKey() as key and the output itself as data. In write-fetch-only mode, only collects entries from fetch nodes.

func InstallScriptExtractors

func InstallScriptExtractors(languages map[string]language.Language) map[string]registry.ArtifactInstallScriptExtractor

InstallScriptExtractors builds the per-ecosystem extractor map used by the package_install_scripts check.

func IsDeprecated

func IsDeprecated(underlying any) bool

func WriteSummary

func WriteSummary(ctx context.Context, input dag_impl.Input, summary AnalysisSummary) error

WriteSummary writes the analysis summary to a file

Types

type AnalysisSummary

type AnalysisSummary struct {
	AnalyzedAt    time.Time                  `json:"analyzed_at"`
	CheckSummary  CheckSummary               `json:"check_summary"`
	NodeSummaries []executiondag.NodeSummary `json:"node_summaries"`
}

AnalysisSummary contains the complete summary of an analysis run

func AggregateSummary

func AggregateSummary(ctx context.Context, dag *executiondag.DAG[dag_impl.Input], checkOutputs []checks.Output, outputDir string) AnalysisSummary

AggregateSummary collects summaries from all nodes and checks

type CheckInfo

type CheckInfo struct {
	Code           string                           `json:"code"`
	Description    string                           `json:"description"`
	WhyThisMatters string                           `json:"why_this_matters,omitempty"`
	Categories     map[category.RiskCategory]string `json:"categories,omitempty"`
	Outcomes       storage.Outcomes                 `json:"outcomes,omitempty"`
	Disclaimers    []string                         `json:"disclaimers,omitempty"`
	Thresholds     map[string]any                   `json:"thresholds,omitempty"`
	Deprecated     bool                             `json:"deprecated,omitempty"`
	DataSources    []string                         `json:"data_sources,omitempty"`
}

func GetAllCheckMetadata

func GetAllCheckMetadata(builder DagBuilder) ([]CheckInfo, map[string]executiondag.Source)

type CheckMetadata

type CheckMetadata interface {
	GetCode() string
	GetDescription() string
}

type CheckSummary

type CheckSummary struct {
	Total          int      `json:"total"`
	Compliant      int      `json:"compliant"`
	Violations     int      `json:"violations"`
	Skipped        int      `json:"skipped"`
	ViolationCodes []string `json:"violation_codes,omitempty"`
}

CheckSummary summarizes check results

type DagBuilder

type DagBuilder func(
	dag *executiondag.DAG[dag_impl.Input],
	input *dag_impl.Input,
	langs map[string]language.Language,
	ctx context.Context,
) error

type DeprecatedCheckMetadata

type DeprecatedCheckMetadata interface {
	GetDeprecated() bool
}

type DocumentedCheckMetadata

type DocumentedCheckMetadata interface {
	GetWhyThisMatters() string
	GetOutcomes() storage.Outcomes
	GetDisclaimers() []string
	GetThresholds() map[string]any
}

type ExtendedCheckMetadata

type ExtendedCheckMetadata interface {
	CheckMetadata
	GetCategories() map[category.RiskCategory]string
}

Jump to

Keyboard shortcuts

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