validator

package
v0.4.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: 6 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 DefaultGit added in v0.4.0

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

func NewDefaultGit added in v0.4.0

func NewDefaultGit(baseDir string) *DefaultGit

func (*DefaultGit) FilesChanged added in v0.4.0

func (d *DefaultGit) FilesChanged(ctx context.Context, sha string) ([]string, error)

func (*DefaultGit) Message added in v0.4.0

func (d *DefaultGit) Message(ctx context.Context, sha string) (string, error)

func (*DefaultGit) SHA added in v0.4.0

func (d *DefaultGit) SHA(ctx context.Context, from, to string) ([]string, error)

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 Options added in v0.4.0

type Options struct {
	Logger         *slog.Logger
	SHALength      int
	Git            Git
	OutsiderFinder OutsiderFinder
	ScopeParser    ScopeParser
}

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(options Options) *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