Documentation
¶
Overview ¶
Package lint provides a simple linter for conventional commits
Index ¶
Constants ¶
View Source
const ( SeverityWarn = "warn" SeverityError = "error" )
Rule Severity Constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Formatter string `yaml:"formatter"`
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 ruleName
type Formatter ¶
type Formatter interface {
// Name is a unique identifier for formatter
Name() string
Format(res *Result) (string, error)
}
Formatter represent a lint result formatter
type Linter ¶
type Linter struct {
// contains filtered or unexported fields
}
Linter is a simple linter for conventional commits
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
Validate(msg *message.Commit) (result string, isValid bool)
}
Rule represent a linter rule
type RuleConfig ¶
type RuleConfig struct {
Enabled bool `yaml:"enabled"`
Severity string `yaml:"severity"`
Argument interface{} `yaml:"argument"`
// Optional flags
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.