validator

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGetMessage      = errors.New("get commit message")
	ErrGetChangedFiles = errors.New("get changed files")
)

Functions

This section is empty.

Types

type Git

type Git interface {
	SHA(ctx context.Context, from, to string) ([]string, error)
	Message(ctx context.Context, sha string) (string, error)
	FilesChanged(ctx context.Context, sha string) ([]string, error)
}

type OutsiderFinder

type OutsiderFinder interface {
	Find(scope string, files []string) []string
}

type ScopeParser

type ScopeParser interface {
	Parse(message string) (string, bool) // scope, ok
}

type Validator

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

func NewValidator

func NewValidator(
	logger *slog.Logger,
	git Git,
	outsiderFinder OutsiderFinder,
	scopeParser ScopeParser,
	shaLength int,
) *Validator

func (*Validator) Validate

func (v *Validator) Validate(ctx context.Context, from, to string) ([]Violation, error)

type Violation

type Violation struct {
	SHA       string   `json:"sha"`
	Header    string   `json:"header"`
	Outsiders []string `json:"outsiders"`
}

Jump to

Keyboard shortcuts

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