size

package
v0.6.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Inspect

Inspect exposes the stateful configuration to the size administration command.

func Members

func Members() []rules.Member

func Register

func Register(reg *rules.Registry)

func Reset

func Reset(ctx context.Context, store BaselineStore, p string, content []byte, tok tokenizer.Tokenizer, actor, note string) (Baseline, Baseline, error)

Types

type Baseline

type Baseline struct {
	Path      string    `json:"path,omitempty"`
	At        time.Time `json:"ts"`
	Op        string    `json:"op"`
	Reason    string    `json:"reason,omitempty"`
	Actor     string    `json:"actor,omitempty"`
	Note      string    `json:"note,omitempty"`
	Commit    string    `json:"commit,omitempty"`
	Kilobytes int       `json:"kilobytes"`
	Lines     int       `json:"lines"`
	Tokens    int       `json:"tokens"`
	Tokenizer string    `json:"tokenizer,omitempty"`
}

func Current

func Current(ctx context.Context, value rules.Check, p string) (Baseline, bool, error)

Current returns the metric-aware effective baseline used by enforcement.

func Measure

func Measure(content []byte, tok tokenizer.Tokenizer) (Baseline, error)

type BaselineStore

type BaselineStore interface {
	Get(context.Context, string) (Baseline, bool, error)
	History(context.Context, string) ([]Baseline, error)
	Record(context.Context, Baseline) error
	Clear(context.Context, string, string) error
	Move(context.Context, string, string) error
}

func NewBaselineStore

func NewBaselineStore(state packagestate.Store) BaselineStore

type Metric

type Metric int
const (
	Kilobytes Metric = iota
	Lines
	Tokens
)

type Rule

type Rule struct{ Metric Metric }

func (Rule) Compile

func (r Rule) Compile(with map[string]any, env rules.Env) (rules.Check, error)

func (Rule) Manifest

func (r Rule) Manifest() rules.Manifest

Jump to

Keyboard shortcuts

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