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 // SetAndCheckArgument sets the argument to the rule from config file // if args are invalid or not expected return an error // SetAndCheckArgument is called before Validate SetAndCheckArgument(arg 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"` }
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.