composition

package
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: Apache-2.0, Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package composition provides a static file composition analyzer that classifies files by type (source, vendor, generated, docs, config, binary, image) using enry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregator

type Aggregator struct {
	common.PerFileRetainer
	// contains filtered or unexported fields
}

Aggregator aggregates file composition results across multiple files.

func NewAggregator

func NewAggregator() *Aggregator

NewAggregator creates a new composition Aggregator.

func (*Aggregator) Aggregate

func (a *Aggregator) Aggregate(results map[string]analyze.Report)

Aggregate accumulates per-file classification results.

func (*Aggregator) GetResult

func (a *Aggregator) GetResult() analyze.Report

GetResult builds the aggregated composition report.

type Analyzer

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

Analyzer implements analyze.RawFileAnalyzer for file composition analysis. It classifies files by type using enry-based detection on raw file content.

func NewAnalyzer

func NewAnalyzer() *Analyzer

NewAnalyzer creates a new composition Analyzer.

func (*Analyzer) AnalyzeFileContent

func (a *Analyzer) AnalyzeFileContent(path string, content []byte) (analyze.Report, error)

AnalyzeFileContent classifies a file by its path and content using enry.

func (*Analyzer) Configure

func (a *Analyzer) Configure(_ map[string]any) error

Configure applies configuration facts.

func (*Analyzer) CreateAggregator

func (a *Analyzer) CreateAggregator() analyze.ResultAggregator

CreateAggregator returns a new composition aggregator.

func (*Analyzer) CreateReportSection

func (a *Analyzer) CreateReportSection(report analyze.Report) analyze.ReportSection

CreateReportSection creates a ReportSection from aggregated composition data.

func (*Analyzer) Descriptor

func (a *Analyzer) Descriptor() analyze.Descriptor

Descriptor returns the analyzer descriptor.

func (*Analyzer) Flag

func (a *Analyzer) Flag() string

Flag returns the CLI flag name.

func (*Analyzer) FormatReport

func (a *Analyzer) FormatReport(report analyze.Report, writer io.Writer) error

FormatReport writes human-readable text output.

func (*Analyzer) FormatReportBinary

func (a *Analyzer) FormatReportBinary(report analyze.Report, writer io.Writer) error

FormatReportBinary writes binary envelope output.

func (*Analyzer) FormatReportJSON

func (a *Analyzer) FormatReportJSON(report analyze.Report, writer io.Writer) error

FormatReportJSON writes JSON output.

func (*Analyzer) FormatReportPlot

func (a *Analyzer) FormatReportPlot(report analyze.Report, writer io.Writer) error

FormatReportPlot writes plot output (same as JSON for composition).

func (*Analyzer) FormatReportYAML

func (a *Analyzer) FormatReportYAML(report analyze.Report, writer io.Writer) error

FormatReportYAML writes YAML output.

func (*Analyzer) ListConfigurationOptions

func (a *Analyzer) ListConfigurationOptions() []pipeline.ConfigurationOption

ListConfigurationOptions returns available configuration options.

func (*Analyzer) Name

func (a *Analyzer) Name() string

Name returns the analyzer name.

func (*Analyzer) Thresholds

func (a *Analyzer) Thresholds() analyze.Thresholds

Thresholds returns metric thresholds. Composition is informational, no thresholds.

type ReportSection

type ReportSection struct {
	analyze.BaseReportSection
	// contains filtered or unexported fields
}

ReportSection implements analyze.ReportSection for composition analysis.

func NewReportSection

func NewReportSection(report analyze.Report) *ReportSection

NewReportSection creates a ReportSection from aggregated composition data.

func (*ReportSection) AllIssues

func (s *ReportSection) AllIssues() []analyze.Issue

AllIssues returns all non-source files as issues.

func (*ReportSection) Distribution

func (s *ReportSection) Distribution() []analyze.DistributionItem

Distribution returns category breakdown as distribution items.

func (*ReportSection) KeyMetrics

func (s *ReportSection) KeyMetrics() []analyze.Metric

KeyMetrics returns ordered key metrics for display.

func (*ReportSection) TopIssues

func (s *ReportSection) TopIssues(n int) []analyze.Issue

TopIssues returns the top N non-source files as issues.

Jump to

Keyboard shortcuts

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