file

package
v0.0.0-...-832881f Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Quote    = "(\"|')"
	OptQuote = Quote + "?"
	Connect  = "\\s*(:|=>|=|:=)\\s*"
)

Variables

This section is empty.

Functions

func AwsPatterns

func AwsPatterns() []string

func GetPreset

func GetPreset(name string) ([]string, error)

func GitHubPatterns

func GitHubPatterns() []string

func GooglePatterns

func GooglePatterns() []string

func NewBlockSecrets

func NewBlockSecrets(appIO io.IO, conf *configuration.Configuration, repo git.Repo) hooks.Action

func NewDoesNotContainRegex

func NewDoesNotContainRegex(appIO io.IO, conf *configuration.Configuration, repo git.Repo) hooks.Action

func NewIsNotEmpty

func NewIsNotEmpty(appIO io.IO, conf *configuration.Configuration, repo git.Repo) hooks.Action

func NewMaxSize

func NewMaxSize(appIO io.IO, conf *configuration.Configuration, repo git.Repo) hooks.Action

func StripePatterns

func StripePatterns() []string

Types

type BlockSecrets

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

BlockSecrets blocks commits if a file is containing a string matching any if the given regexes.

Example configuration:

{
  "run": "CaptainHook::File.BlockSecrets",
  "options: {
    "presets": ["Aws", "GitHub", "Stripe", "Google"],
    "blocked": ["pattern1", "pattern2"],
    "allowed": ["patternA"]
  }
}

func (*BlockSecrets) IsApplicableFor

func (a *BlockSecrets) IsApplicableFor(hook string) bool

func (*BlockSecrets) Run

func (a *BlockSecrets) Run(action *configuration.Action) error

type DoesNotContainRegex

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

DoesNotContainRegex blocks commits if a file is containing a string matching the given regex.

Example configuration:

{
  "run": "CaptainHook::File.DoesNotContainRegex",
  "options: {
    "regex": "shouldNotContainThis"
  }
}

func (*DoesNotContainRegex) IsApplicableFor

func (a *DoesNotContainRegex) IsApplicableFor(hook string) bool

func (*DoesNotContainRegex) Run

type IsNotEmpty

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

IsNotEmpty is preventing you from committing empty files to the repository

Example configuration:

{
  "run": "CaptainHook::File:IsNotEmpty",
  "options": {
    "files": ["README.md", "LICENSE.md"]
  }
}

func (*IsNotEmpty) IsApplicableFor

func (a *IsNotEmpty) IsApplicableFor(hook string) bool

func (*IsNotEmpty) Run

func (a *IsNotEmpty) Run(action *configuration.Action) error

type MaxSize

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

MaxSize is preventing you from committing files exceeding a given size limit

Example configuration:

{
  "run": "CaptainHook::File:MaxSize",
  "options": {
    "max-size": "10M"
  }
}

func (*MaxSize) IsApplicableFor

func (a *MaxSize) IsApplicableFor(hook string) bool

func (*MaxSize) Run

func (a *MaxSize) Run(action *configuration.Action) error

Jump to

Keyboard shortcuts

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