ci

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HighestUserWastedPercent

type HighestUserWastedPercent struct {
	Threshold float64
}

HighestUserWastedPercent fails if wasted bytes as a fraction of total size exceed the threshold. A threshold of 0 disables this rule (always passes).

func (HighestUserWastedPercent) Evaluate

func (r HighestUserWastedPercent) Evaluate(result *image.EfficiencyResult, totalSize int64) RuleResult

func (HighestUserWastedPercent) Name

type HighestWastedBytes

type HighestWastedBytes struct {
	Threshold int64
}

HighestWastedBytes fails if wasted bytes exceed the threshold. A threshold of 0 disables this rule (always passes).

func (HighestWastedBytes) Evaluate

func (r HighestWastedBytes) Evaluate(result *image.EfficiencyResult, _ int64) RuleResult

func (HighestWastedBytes) Name

func (r HighestWastedBytes) Name() string

type LowestEfficiency

type LowestEfficiency struct {
	Threshold float64
}

LowestEfficiency fails if the efficiency score is below the threshold. A threshold of 0 (or any non-positive value) disables this rule. A NaN score (e.g. an empty image with zero total bytes) is treated as a pass — the rule cannot meaningfully evaluate a non-finite score.

func (LowestEfficiency) Evaluate

func (r LowestEfficiency) Evaluate(result *image.EfficiencyResult, _ int64) RuleResult

func (LowestEfficiency) Name

func (r LowestEfficiency) Name() string

type Report

type Report struct {
	Passed   bool
	Results  []RuleResult
	TopWaste []image.WastedFile
	Score    float64
}

Report holds the results of all rule evaluations.

func Evaluate

func Evaluate(efficiency *image.EfficiencyResult, totalSize int64, rules []Rule) *Report

Evaluate runs all rules against the efficiency result and returns a report. A nil efficiency argument is treated as a zero-value result (score 0, no wasted files); rules still run, which lets callers surface "no analysis available" cleanly without needing to nil-guard at every call site.

func (*Report) ExitCode

func (r *Report) ExitCode() int

ExitCode returns 0 if all rules passed, 1 otherwise.

func (*Report) Print

func (r *Report) Print(w io.Writer)

Print writes the human-readable report to w.

type Rule

type Rule interface {
	Name() string
	Evaluate(result *image.EfficiencyResult, totalSize int64) RuleResult
}

Rule evaluates one aspect of image efficiency.

type RuleResult

type RuleResult struct {
	Passed    bool
	Name      string
	Actual    string
	Threshold string
}

RuleResult holds the outcome of evaluating a single rule.

Jump to

Keyboard shortcuts

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