Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindConfigurationFilePath ¶
FindConfigurationFilePath searches the git-commit-hook config file in various places and returns the first found filepath or error
Types ¶
type BranchTypePattern ¶
type BranchTypePattern string
BranchTypePattern defines a regex pattern that identifies a branch type
type BranchTypeTemplate ¶
type BranchTypeTemplate string
BranchTypeTemplate holds a go template that defined the modified commit message
type BranchValidationConfiguration ¶
BranchValidationConfiguration holds a regex pattern in the index and a test description in the value of the map The pattern will be tested against a prepared commit message.
type Configuration ¶
Configuration is the data representation of the config file structure
func LoadConfiguration ¶
func LoadConfiguration() (*Configuration, error)
LoadConfiguration loads the git-commit-hook configuration from file.
func (*Configuration) GetProjectByName ¶
func (c *Configuration) GetProjectByName(projectName string) (Project, error)
GetProjectByName returns a Project for the given project name
func (*Configuration) GetProjectByRepoPath ¶
func (c *Configuration) GetProjectByRepoPath(path string) (Project, error)
GetProjectByRepoPath returns a Project for the given git repository path
type Project ¶
type Project struct { // Path to the git repository this configuration should be used while committing Path string `yaml:"path"` // BranchTypes is a map whose key defines a BranchType - it's value holds a pattern that identifies // a given branch name to be of that branch type. BranchTypes map[string]BranchTypePattern `yaml:"branch"` // Templates is a map whose key refers a branchType - it's value holds a go template that will render the commit message Templates map[string]BranchTypeTemplate `yaml:"template"` // Validation is a map whose key refers a branchType - it's value holds configuration to validate the created commit message Validation map[string]BranchValidationConfiguration `yaml:"validation"` }
Project defined a project related section of the Configuration
func LoadProjectConfigurationByName ¶
LoadProjectConfigurationByName loads a project configuration by its name
func LoadProjectConfigurationFromCommitMessageFileDir ¶
LoadProjectConfigurationFromCommitMessageFileDir loads a project configuration by resolving a given commit-message file
func (*Project) GetBranchType ¶
GetBranchType returns a branch type for the given branch name or empty string if no branch type was found.