policy

package
v0.1.0-alpha.30 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MPL-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package policy provides base policy definitions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check interface {
	Name() string
	Message() string
	Errors() []error
}

Check defines a policy check.

type Option

type Option func(*Options)

Option is a functional option used to pass in arguments to a Policy.

func WithCommitMsgFile

func WithCommitMsgFile(o *string) Option

WithCommitMsgFile sets the path to the commit message file.

func WithCommitRef

func WithCommitRef(o string) Option

WithCommitRef sets the ref to compare git policies against.

func WithRevisionRange

func WithRevisionRange(o string) Option

WithRevisionRange sets the revision range to compare git policies against.

type Options

type Options struct {
	CommitMsgFile *string
	CommitRef     string
	RevisionRange string
}

Options defines the set of options available to a Policy.

func NewDefaultOptions

func NewDefaultOptions(setters ...Option) *Options

NewDefaultOptions initializes a Options struct with default values.

type Policy

type Policy interface {
	Compliance(*Options) (*Report, error)
}

Policy is an interface that policies must implement.

type Report

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

Report reports the compliance of a policy.

func (*Report) AddCheck

func (r *Report) AddCheck(c Check)

AddCheck adds a check to the policy report.

func (*Report) Checks

func (r *Report) Checks() []Check

Checks returns the checks executed by a policy.

func (*Report) Valid

func (r *Report) Valid() bool

Valid checks if a report is valid.

Directories

Path Synopsis
Package commit provides commit-related policies.
Package commit provides commit-related policies.
Package license provides license policy.
Package license provides license policy.
Package version provides version policies.
Package version provides version policies.

Jump to

Keyboard shortcuts

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