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
type Commit interface {
Message() string
Header() string
Body() string
Type() string
Scope() string
Description() string
Notes() []Note
IsBreakingChange() bool
}
Commit represent a commit message
type Config ¶
type Config struct {
// MinVersion is the minimum version of commitlint required
// should be in semver format
MinVersion string `yaml:"version"`
// Formatter of the lint result
Formatter string `yaml:"formatter"`
// Enabled Rules
Rules []string `yaml:"rules"`
// Severity
Severity SeverityConfig `yaml:"severity"`
// Settings is rule name to rule settings
Settings map[string]RuleSetting `yaml:"settings"`
}
Config represent linter config
func (*Config) GetRule ¶
func (c *Config) GetRule(ruleName string) RuleSetting
GetRule returns RuleConfig for given rule name
func (*Config) GetSeverity ¶ added in v0.8.0
GetSeverity returns Severity for given ruleName
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 Issue ¶ added in v0.8.0
type Issue struct {
// contains filtered or unexported fields
}
Issue holds a rule result
func (*Issue) Description ¶ added in v0.8.0
Description returns description of the issue
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 a linter result
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(setting RuleSetting) error
// Validate validates the rule for given commit message
// if given commit is valid, return true and messages slice are ignored
// if invalid, return a error messages with false
Validate(msg Commit) (issue *Issue, isValid bool)
}
Rule represent a linter rule
type RuleSetting ¶ added in v0.8.0
type RuleSetting struct {
Argument interface{} `yaml:"argument"`
Flags map[string]interface{} `yaml:"flags,omitempty"`
}
RuleSetting represent config for a rule
type Severity ¶ added in v0.5.0
type Severity string
Severity represent the severity level of a rule
type SeverityConfig ¶ added in v0.8.0
type SeverityConfig struct {
Default Severity `yaml:"default"`
Rules map[string]Severity `yaml:"rules,omitempty"`
}
SeverityConfig represent severity levels for rules
Click to show internal directories.
Click to hide internal directories.