v2

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const ErrorSeverity = "error"

ErrorSeverity set to issue an error and terminate commit

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Version                   string                    `yaml:"version"`                  // Version denotes the configuration file version
	IgnoreExpressions         []string                  `yaml:"ignore"`                   // IgnoreExpressions is a list of regular expressions that determine whether a line should be checked or not
	SubjectExpressions        []*ExpressionWithSeverity `yaml:"subject"`                  // SubjectExpressions is a list of regular expressions to check the first line
	FindOccurrenceExpressions []*ExpressionWithSeverity `yaml:"occurs"`                   // FindOccurrenceExpressions is a list of expressions that have to match at least once
	Externals                 []*Tool                   `yaml:"external-tools"`           // Externals is a list of tools to call before accepting a commit
	SubjectLineLength         int                       `yaml:"subject-line-length"`      // SubjectLineLength provides the ability to limit the subject line's length
	BodyRequired              bool                      `yaml:"body-required"`            // BodyRequired forces a body if set
	SeparateBody              bool                      `yaml:"separate-body"`            // SeparateBody forces a blank line between subject and body
	BodyLineLength            int                       `yaml:"body-line-length"`         // BodyLineLength provides the ability to limit the body lines' length
	EnforceBodyLineLength     bool                      `yaml:"enforce-body-line-length"` // EnforceBodyLineLength determines whether to print a warning when body line length it too long or to error
	ExternalChecks            []string                  `yaml:"calls"`                    // ExternalChecks contains a list of commands to execute
	LintGitLabCI              bool                      `yaml:"lint_gitlab_ci"`           // LintGitLabCI determines whether gitlab-ci-linter will be called
	GitLabCIFile              string                    `yaml:"gitlab_ci_file"`           // GitLabCIFile use this to override .gitlab-ci.yml location
	ConfDDirectoriesEnabled   bool                      `yaml:"confd-directories"`        // are .commit-msg.d directories enabled
	// contains filtered or unexported fields
}

Configuration is used to load global/per-project configuration codebeat:disable[TOO_MANY_IVARS]

func LoadConfig

func LoadConfig() (*Configuration, error)

LoadConfig handles global and local configuration

func (*Configuration) ExecuteConfDDirectories added in v1.1.0

func (cfg *Configuration) ExecuteConfDDirectories() bool

ExecuteConfDDirectories run scrips in .commit-msg.d/ directory

func (*Configuration) Validate

func (cfg *Configuration) Validate(commitMessage []string) (bool, error)

Validate validates the message against the rules

type ExpressionWithSeverity

type ExpressionWithSeverity struct {
	Expression string `yaml:"expression"` // Regular expression
	Severity   string `yaml:"severity"`   // Severity name
	Name       string `yaml:"name"`       // Name of expression
	// contains filtered or unexported fields
}

ExpressionWithSeverity is a container for expressions that may be errors or warnings

type Tool

type Tool struct {
	Command  []string `yaml:"command"`  // Command to execute
	Name     string   `yaml:"name"`     // Name of rule
	Severity string   `yaml:"severity"` // Severity name
}

Tool is a description how to run external tool for commit

Jump to

Keyboard shortcuts

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