Documentation
¶
Overview ¶
Package lint provides a simple linter for conventional commits
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Commit ¶ added in v0.5.0
Commit represent a commit message for now it is an alias of parser.Commit
type Config ¶
type Config struct {
// Formatter of the lint result
Formatter string `yaml:"formatter"`
// Rules is rule name to rule config map
Rules map[string]RuleConfig `yaml:"rules"`
}
Config represent linter config
func (*Config) GetRule ¶
func (c *Config) GetRule(ruleName string) RuleConfig
GetRule returns RuleConfig for given rule name
type Formatter ¶
type Formatter interface {
// Name is a unique identifier for formatter
Name() string
// Format formats the linter result
Format(result *Result) (string, error)
}
Formatter represent a lint result formatter
type Linter ¶
type Linter struct {
// contains filtered or unexported fields
}
Linter is linter for commit message
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result holds result of linter
type Rule ¶
type Rule interface {
// Name returns name of the rule, it should be a unique identifier
Name() string
// Apply calls with arguments and flags for the rule from config file
// if flags or arguments are invalid or not expected return an error
// Apply is called before Validate
Apply(arg interface{}, flags map[string]interface{}) error
// Validate validates the rule for given message
// if given message is valid, return true and result string is ignored
// if invalid, return a error result with false
Validate(msg *Commit) (result string, isValid bool)
}
Rule represent a linter rule
type RuleConfig ¶
type RuleConfig struct {
Enabled bool `yaml:"enabled"`
Severity Severity `yaml:"severity"`
Argument interface{} `yaml:"argument"`
// Flags are optional key value pairs
Flags map[string]interface{} `yaml:"flags"`
}
RuleConfig represent config for a rule
type RuleResult ¶
RuleResult holds result of a linter rule
Click to show internal directories.
Click to hide internal directories.