report

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ColorReset  = colorReset
	ColorRed    = "\033[31m"
	ColorYellow = colorYellow
	ColorGreen  = colorGreen
	ColorCyan   = colorCyan
	ColorBold   = colorBold
	ColorDim    = colorDim
)

Exported color codes for use by format-specific files.

View Source
const (
	BoxTopLeft     = "┌"
	BoxTopRight    = "┐"
	BoxBottomLeft  = "└"
	BoxBottomRight = "┘"
	BoxHorizontal  = "─"
	BoxVertical    = "│"
	BoxTeeLeft     = "├"
	BoxTeeRight    = "┤"
)

Box drawing characters

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Format         Format
	Verbose        bool
	Writer         io.Writer
	ShowProgress   bool
	ProgressWriter io.Writer // Where to write progress output; defaults to Writer if nil
}

Config holds configuration for report generation

type CriticalIssue

type CriticalIssue struct {
	PackageName    string
	PackageVersion string
	Ecosystem      string
	RiskLevel      string
	Description    string
	Evidence       string
	Severity       string
	SourceURL      string
}

CriticalIssue represents a critical finding with package details

type Format

type Format string

Format represents the output format type

const (
	FormatText     Format = "text"
	FormatMarkdown Format = "markdown"
	FormatJSON     Format = "json"
	FormatHTML     Format = "html"
)

type JSONCriticalIssue

type JSONCriticalIssue struct {
	PackageName    string `json:"package_name"`
	PackageVersion string `json:"package_version"`
	Ecosystem      string `json:"ecosystem"`
	RiskLevel      string `json:"risk_level"`
	Severity       string `json:"severity"`
	Description    string `json:"description"`
	Evidence       string `json:"evidence,omitempty"`
	SourceURL      string `json:"source_url,omitempty"`
}

JSONCriticalIssue represents a critical issue in JSON format

type JSONReport

type JSONReport struct {
	Metadata struct {
		GeneratedAt   string `json:"generated_at"`
		ScanPath      string `json:"scan_path"`
		ManifestFiles int    `json:"manifest_files"`
	} `json:"metadata"`
	Summary struct {
		TotalPackages          int     `json:"total_packages"`
		DirectDependencies     int     `json:"direct_dependencies"`
		TransitiveDependencies int     `json:"transitive_dependencies"`
		HighRisk               int     `json:"high_risk"`
		MediumRisk             int     `json:"medium_risk"`
		LowRisk                int     `json:"low_risk"`
		OverallRisk            string  `json:"overall_risk"`
		ScanDuration           float64 `json:"scan_duration_seconds"`
	} `json:"summary"`
	ExecutiveSummary struct {
		KeyFindings []JSONCriticalIssue `json:"key_findings"`
		Summary     string              `json:"summary"`
	} `json:"executive_summary"`
	Results      interface{}    `json:"results"`
	KeyRiskAreas []JSONRiskArea `json:"key_risk_areas"`
}

JSONReport represents the JSON output structure

type JSONRiskArea added in v1.9.0

type JSONRiskArea struct {
	Tag         string   `json:"tag"`
	Summary     string   `json:"summary"`
	Explanation string   `json:"explanation"`
	Examples    []string `json:"examples,omitempty"`
}

JSONRiskArea represents a risk area in JSON format

type Reporter

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

Reporter handles report generation

func NewReporter

func NewReporter(config Config) *Reporter

NewReporter creates a new reporter

func (*Reporter) AddResults

func (r *Reporter) AddResults(results []models.AnalysisResult)

AddResults adds analysis results to the report

func (*Reporter) ClearProgress

func (r *Reporter) ClearProgress()

ClearProgress clears the progress line

func (*Reporter) Generate

func (r *Reporter) Generate() error

Generate generates the report

func (*Reporter) HasProgress added in v1.6.0

func (r *Reporter) HasProgress() bool

HasProgress returns true if the reporter is configured to show progress bars

func (*Reporter) SetDependencyCounts added in v1.8.1

func (r *Reporter) SetDependencyCounts(direct, transitive int)

SetDependencyCounts sets the direct and transitive dependency counts. These reflect the total found before any filtering is applied.

func (*Reporter) SetManifestCount

func (r *Reporter) SetManifestCount(count int)

SetManifestCount sets the number of manifest files found

func (*Reporter) SetScanPath

func (r *Reporter) SetScanPath(path string)

SetScanPath sets the path that was scanned

func (*Reporter) ShowProgress

func (r *Reporter) ShowProgress(current, total int, packageName string)

ShowProgress displays an enhanced progress indicator with time info and animations

type ScanStats

type ScanStats struct {
	StartTime      time.Time
	EndTime        time.Time
	TotalPackages  int
	HighRisk       int
	MediumRisk     int
	LowRisk        int
	ManifestFiles  int
	ScannedPath    string
	DirectDeps     int // Number of direct dependencies found (before filtering)
	TransitiveDeps int // Number of transitive dependencies found (before filtering)
}

ScanStats contains scan statistics

Jump to

Keyboard shortcuts

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