hooks

package
v0.0.0-...-dfd8685 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action interface {
	// IsApplicableFor answers if an `Action` can be used for a given hook
	// For example actions that verify the commit message are only applicable for
	// the `commit-message` hook.
	IsApplicableFor(hook string) bool

	// Run executes the action
	// This will either execute some functionality provided from CaptainHook
	// or some external executable.
	Run(action *configuration.Action) error
}

type ActionLog

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

func NewActionLog

func NewActionLog() *ActionLog

func (*ActionLog) Add

func (a *ActionLog) Add(item *ActionLogItem)

func (*ActionLog) HasLogs

func (a *ActionLog) HasLogs() bool

func (*ActionLog) Logs

func (a *ActionLog) Logs() []*ActionLogItem

type ActionLogItem

type ActionLogItem struct {
	Conf        *configuration.Action
	CollectorIO *io.CollectorIO
	Status      int
}

func NewActionLogItem

func NewActionLogItem(action *configuration.Action, collectorIO *io.CollectorIO, status int) *ActionLogItem

type Condition

type Condition interface {
	IsApplicableFor(hook string) bool
	IsTrue(condition *configuration.Condition) bool
}

type HookBundle

type HookBundle struct {
	AppIO       io.IO
	Conf        *configuration.Configuration
	Repo        git.Repo
	Restriction *Restriction
}

func NewHookBundle

func NewHookBundle(appIO io.IO, conf *configuration.Configuration, repo git.Repo, hooks []string) *HookBundle

type Restriction

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

Restriction is responsible to restrict Action or Condition to specific hooks. For example Condition that requires staged files is only applicable for 'pre-commit' hooks.

func NewRestriction

func NewRestriction(hooks []string) *Restriction

func (*Restriction) IsApplicableFor

func (r *Restriction) IsApplicableFor(hook string) bool

Jump to

Keyboard shortcuts

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