value

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorNameLen    = "value name must be 3 - 20 characters long"
	ErrorNameChars  = "value name must be only latin lowercase characters or -_"
	ErrorRegexpEnds = "must contain start `^` and end `$` for full line validation"
	NameMinLen      = 3
	NameMaxLen      = 20

	ErrorValueEmpty = "regexp or allowed must be filled"
	ErrorValueBoth  = "regexp and allowed can't be filled together"

	Regexp          = "regexp"
	ValuesConfigKey = "commit.values"

	TitleValue   = "title"
	TypeValue    = "type"
	ContextValue = "context"
	IssueValue   = "issue"
)

Variables

View Source
var (
	NameRegex         = regexp.MustCompile("^[a-z-_]+$")
	DefaultProperties = Properties{
		TypeValue: {
			Allowed: map[string]struct{}{
				"fix":  {},
				"feat": {},
			},
		},
		ContextValue: {
			Regexp: regexp.MustCompile("^[a-z-_]+$"),
			MaxLen: 10,
		},
		TitleValue: {
			Regexp: regexp.MustCompile(`^[\w ]+$`),
			MaxLen: 50,
		},
		IssueValue: {
			Regexp: regexp.MustCompile(`^#\d+$`),
			MaxLen: 5,
		},
	}
)

Functions

This section is empty.

Types

type Name

type Name string

type Properties

type Properties map[Name]Property

func Get

func Get(c conf.Conf) (Properties, error)

type Property

type Property struct {
	Regexp  *regexp.Regexp
	Allowed map[string]struct{}
	MaxLen  int
}

func (Property) Validate

func (p Property) Validate(v string) string

type Value

type Value string

type Values

type Values map[Name]Value

Jump to

Keyboard shortcuts

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