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 ¶
- type Aggregator
- type Analyzer
- func (a *Analyzer) AnalyzeFileContent(path string, content []byte) (analyze.Report, error)
- func (a *Analyzer) Configure(_ map[string]any) error
- func (a *Analyzer) CreateAggregator() analyze.ResultAggregator
- func (a *Analyzer) CreateReportSection(report analyze.Report) analyze.ReportSection
- func (a *Analyzer) Descriptor() analyze.Descriptor
- func (a *Analyzer) Flag() string
- func (a *Analyzer) FormatReport(report analyze.Report, writer io.Writer) error
- func (a *Analyzer) FormatReportBinary(report analyze.Report, writer io.Writer) error
- func (a *Analyzer) FormatReportJSON(report analyze.Report, writer io.Writer) error
- func (a *Analyzer) FormatReportPlot(report analyze.Report, writer io.Writer) error
- func (a *Analyzer) FormatReportYAML(report analyze.Report, writer io.Writer) error
- func (a *Analyzer) ListConfigurationOptions() []pipeline.ConfigurationOption
- func (a *Analyzer) Name() string
- func (a *Analyzer) Thresholds() analyze.Thresholds
- type ReportSection
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 (*Analyzer) AnalyzeFileContent ¶
AnalyzeFileContent classifies a file by its path and content using enry.
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) FormatReport ¶
FormatReport writes human-readable text output.
func (*Analyzer) FormatReportBinary ¶
FormatReportBinary writes binary envelope output.
func (*Analyzer) FormatReportJSON ¶
FormatReportJSON writes JSON output.
func (*Analyzer) FormatReportPlot ¶
FormatReportPlot writes plot output (same as JSON for composition).
func (*Analyzer) FormatReportYAML ¶
FormatReportYAML writes YAML output.
func (*Analyzer) ListConfigurationOptions ¶
func (a *Analyzer) ListConfigurationOptions() []pipeline.ConfigurationOption
ListConfigurationOptions returns available configuration options.
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.