Documentation
¶
Overview ¶
Package rule contains lint rules
Index ¶
- Variables
- type BodyCaseRule
- type BodyEmptyRule
- type BodyFullStopRule
- type BodyLeadingBlankRule
- type BodyMaxLenRule
- type BodyMaxLineLenRule
- type BodyMinLenRule
- type BreakingChangeExclamationMarkRule
- type DescriptionCaseRule
- type DescriptionEmptyRule
- type DescriptionFullStopRule
- type DescriptionMaxLenRule
- type DescriptionMinLenRule
- type FooterEmptyRule
- type FooterEnumRule
- type FooterLeadingBlankRule
- type FooterMaxLenRule
- type FooterMaxLineLenRule
- type FooterMinLenRule
- type FooterTypeEnumParam
- type FooterTypeEnumRule
- type HeadMaxLenRule
- type HeadMinLenRule
- type HeaderCaseRule
- type HeaderFullStopRule
- type HeaderTrimRule
- type ScopeCaseRule
- type ScopeCharsetRule
- type ScopeEmptyRule
- type ScopeEnumRule
- type ScopeMaxLenRule
- type ScopeMinLenRule
- type SignedOffByRule
- type TrailerExistsRule
- type TypeCaseRule
- type TypeCharsetRule
- type TypeEmptyRule
- type TypeEnumRule
- type TypeMaxLenRule
- type TypeMinLenRule
Constants ¶
This section is empty.
Variables ¶
var CaseValues = casing.All
CaseValues is the ordered list of supported case formats. Use the casing.* constants (e.g. casing.Lower, casing.Pascal) when referring to individual formats in code.
Functions ¶
This section is empty.
Types ¶
type BodyCaseRule ¶ added in v0.12.0
type BodyCaseRule struct{ Case string }
BodyCaseRule validates that the commit body as a whole matches a given case format. An empty body always passes. Argument: one of the casing.* constants.
func (*BodyCaseRule) Apply ¶ added in v0.12.0
func (r *BodyCaseRule) Apply(s lint.RuleSetting) error
func (*BodyCaseRule) Name ¶ added in v0.12.0
func (r *BodyCaseRule) Name() string
type BodyEmptyRule ¶ added in v0.12.0
type BodyEmptyRule struct{}
BodyEmptyRule validates that the commit body is not empty.
func (*BodyEmptyRule) Apply ¶ added in v0.12.0
func (r *BodyEmptyRule) Apply(_ lint.RuleSetting) error
func (*BodyEmptyRule) Name ¶ added in v0.12.0
func (r *BodyEmptyRule) Name() string
type BodyFullStopRule ¶ added in v0.12.0
type BodyFullStopRule struct{ Char string }
BodyFullStopRule checks that the body does NOT end with a given character.
func (*BodyFullStopRule) Apply ¶ added in v0.12.0
func (r *BodyFullStopRule) Apply(s lint.RuleSetting) error
func (*BodyFullStopRule) Name ¶ added in v0.12.0
func (r *BodyFullStopRule) Name() string
type BodyLeadingBlankRule ¶ added in v0.12.0
type BodyLeadingBlankRule struct{}
BodyLeadingBlankRule checks that when a body is present, it begins with a blank line (i.e. the raw commit message has an empty line between header and body). Per the Conventional Commits spec the parser already trims the leading blank, but we can detect its presence via the full commit Message(): the body section should start after two newlines (header + blank line + body).
func (*BodyLeadingBlankRule) Apply ¶ added in v0.12.0
func (r *BodyLeadingBlankRule) Apply(_ lint.RuleSetting) error
func (*BodyLeadingBlankRule) Name ¶ added in v0.12.0
func (r *BodyLeadingBlankRule) Name() string
type BodyMaxLenRule ¶
type BodyMaxLenRule struct{ CheckLen int }
BodyMaxLenRule to validate max length of body
func (*BodyMaxLenRule) Apply ¶ added in v0.4.0
func (r *BodyMaxLenRule) Apply(s lint.RuleSetting) error
func (*BodyMaxLenRule) Name ¶
func (r *BodyMaxLenRule) Name() string
type BodyMaxLineLenRule ¶
type BodyMaxLineLenRule struct{ CheckLen int }
BodyMaxLineLenRule to validate max line length of body
func (*BodyMaxLineLenRule) Apply ¶ added in v0.4.0
func (r *BodyMaxLineLenRule) Apply(s lint.RuleSetting) error
func (*BodyMaxLineLenRule) Name ¶
func (r *BodyMaxLineLenRule) Name() string
type BodyMinLenRule ¶
type BodyMinLenRule struct{ CheckLen int }
BodyMinLenRule to validate min length of body
func (*BodyMinLenRule) Apply ¶ added in v0.4.0
func (r *BodyMinLenRule) Apply(s lint.RuleSetting) error
func (*BodyMinLenRule) Name ¶
func (r *BodyMinLenRule) Name() string
type BreakingChangeExclamationMarkRule ¶ added in v0.12.0
type BreakingChangeExclamationMarkRule struct{}
BreakingChangeExclamationMarkRule implements the breaking-change-exclamation-mark rule.
It enforces that breaking changes are signalled consistently via an XNOR:
- PASS when the header contains "!" AND a footer note has token "BREAKING CHANGE" or "BREAKING-CHANGE".
- PASS when neither signal is present.
- FAIL when exactly one of the two is present.
Detection uses the parsed Notes() (footer tokens), not raw string scanning.
func (*BreakingChangeExclamationMarkRule) Apply ¶ added in v0.12.0
func (r *BreakingChangeExclamationMarkRule) Apply(_ lint.RuleSetting) error
func (*BreakingChangeExclamationMarkRule) Name ¶ added in v0.12.0
func (r *BreakingChangeExclamationMarkRule) Name() string
type DescriptionCaseRule ¶ added in v0.12.0
type DescriptionCaseRule struct{ Case string }
DescriptionCaseRule validates that the commit description (subject) matches a given case format. Argument: one of the casing.* constants.
func (*DescriptionCaseRule) Apply ¶ added in v0.12.0
func (r *DescriptionCaseRule) Apply(s lint.RuleSetting) error
func (*DescriptionCaseRule) Name ¶ added in v0.12.0
func (r *DescriptionCaseRule) Name() string
type DescriptionEmptyRule ¶ added in v0.12.0
type DescriptionEmptyRule struct{}
DescriptionEmptyRule validates that the commit description is not empty.
func (*DescriptionEmptyRule) Apply ¶ added in v0.12.0
func (r *DescriptionEmptyRule) Apply(_ lint.RuleSetting) error
func (*DescriptionEmptyRule) Name ¶ added in v0.12.0
func (r *DescriptionEmptyRule) Name() string
type DescriptionFullStopRule ¶ added in v0.12.0
type DescriptionFullStopRule struct{ Char string }
DescriptionFullStopRule checks that the description does NOT end with a given character.
func (*DescriptionFullStopRule) Apply ¶ added in v0.12.0
func (r *DescriptionFullStopRule) Apply(s lint.RuleSetting) error
func (*DescriptionFullStopRule) Name ¶ added in v0.12.0
func (r *DescriptionFullStopRule) Name() string
type DescriptionMaxLenRule ¶
type DescriptionMaxLenRule struct{ CheckLen int }
DescriptionMaxLenRule to validate max length of description
func (*DescriptionMaxLenRule) Apply ¶ added in v0.4.0
func (r *DescriptionMaxLenRule) Apply(s lint.RuleSetting) error
func (*DescriptionMaxLenRule) Name ¶
func (r *DescriptionMaxLenRule) Name() string
type DescriptionMinLenRule ¶
type DescriptionMinLenRule struct{ CheckLen int }
DescriptionMinLenRule to validate min length of description
func (*DescriptionMinLenRule) Apply ¶ added in v0.4.0
func (r *DescriptionMinLenRule) Apply(s lint.RuleSetting) error
func (*DescriptionMinLenRule) Name ¶
func (r *DescriptionMinLenRule) Name() string
type FooterEmptyRule ¶ added in v0.12.0
type FooterEmptyRule struct{}
FooterEmptyRule validates that the commit footer is not empty.
func (*FooterEmptyRule) Apply ¶ added in v0.12.0
func (r *FooterEmptyRule) Apply(_ lint.RuleSetting) error
func (*FooterEmptyRule) Name ¶ added in v0.12.0
func (r *FooterEmptyRule) Name() string
type FooterEnumRule ¶ added in v0.8.0
type FooterEnumRule struct {
}
FooterEnumRule to validate footer tokens
func (*FooterEnumRule) Apply ¶ added in v0.8.0
func (r *FooterEnumRule) Apply(setting lint.RuleSetting) error
Apply sets the needed argument for the rule
func (*FooterEnumRule) Name ¶ added in v0.8.0
func (r *FooterEnumRule) Name() string
Name return name of the rule
type FooterLeadingBlankRule ¶ added in v0.12.0
type FooterLeadingBlankRule struct{}
FooterLeadingBlankRule checks that when a footer is present, it begins with a blank line (i.e. there is an empty line between body/header and footer).
func (*FooterLeadingBlankRule) Apply ¶ added in v0.12.0
func (r *FooterLeadingBlankRule) Apply(_ lint.RuleSetting) error
func (*FooterLeadingBlankRule) Name ¶ added in v0.12.0
func (r *FooterLeadingBlankRule) Name() string
type FooterMaxLenRule ¶
FooterMaxLenRule to validate max length of footer
func (*FooterMaxLenRule) Apply ¶ added in v0.4.0
func (r *FooterMaxLenRule) Apply(s lint.RuleSetting) error
func (*FooterMaxLenRule) Name ¶
func (r *FooterMaxLenRule) Name() string
type FooterMaxLineLenRule ¶
FooterMaxLineLenRule to validate max line length of footer
func (*FooterMaxLineLenRule) Apply ¶ added in v0.4.0
func (r *FooterMaxLineLenRule) Apply(s lint.RuleSetting) error
func (*FooterMaxLineLenRule) Name ¶
func (r *FooterMaxLineLenRule) Name() string
type FooterMinLenRule ¶
FooterMinLenRule to validate min length of footer
func (*FooterMinLenRule) Apply ¶ added in v0.4.0
func (r *FooterMinLenRule) Apply(s lint.RuleSetting) error
func (*FooterMinLenRule) Name ¶
func (r *FooterMinLenRule) Name() string
type FooterTypeEnumParam ¶ added in v0.9.0
type FooterTypeEnumParam struct {
}
FooterTypeEnumParam represent a single footer type param
type FooterTypeEnumRule ¶ added in v0.9.0
type FooterTypeEnumRule struct {
}
FooterTypeEnumRule to validate footer tokens
func (*FooterTypeEnumRule) Apply ¶ added in v0.9.0
func (r *FooterTypeEnumRule) Apply(setting lint.RuleSetting) error
Apply sets the needed argument for the rule
func (*FooterTypeEnumRule) Name ¶ added in v0.9.0
func (r *FooterTypeEnumRule) Name() string
Name return name of the rule
type HeadMaxLenRule ¶
type HeadMaxLenRule struct{ CheckLen int }
HeadMaxLenRule to validate max length of header
func (*HeadMaxLenRule) Apply ¶ added in v0.4.0
func (r *HeadMaxLenRule) Apply(s lint.RuleSetting) error
func (*HeadMaxLenRule) Name ¶
func (r *HeadMaxLenRule) Name() string
type HeadMinLenRule ¶
type HeadMinLenRule struct{ CheckLen int }
HeadMinLenRule to validate min length of header
func (*HeadMinLenRule) Apply ¶ added in v0.4.0
func (r *HeadMinLenRule) Apply(s lint.RuleSetting) error
func (*HeadMinLenRule) Name ¶
func (r *HeadMinLenRule) Name() string
type HeaderCaseRule ¶ added in v0.12.0
type HeaderCaseRule struct{ Case string }
HeaderCaseRule validates that the commit header matches a given case format. Argument: one of the casing.* constants.
func (*HeaderCaseRule) Apply ¶ added in v0.12.0
func (r *HeaderCaseRule) Apply(s lint.RuleSetting) error
func (*HeaderCaseRule) Name ¶ added in v0.12.0
func (r *HeaderCaseRule) Name() string
type HeaderFullStopRule ¶ added in v0.12.0
type HeaderFullStopRule struct{ Char string }
HeaderFullStopRule checks that the header does NOT end with a given character. Default character is ".".
func (*HeaderFullStopRule) Apply ¶ added in v0.12.0
func (r *HeaderFullStopRule) Apply(s lint.RuleSetting) error
func (*HeaderFullStopRule) Name ¶ added in v0.12.0
func (r *HeaderFullStopRule) Name() string
type HeaderTrimRule ¶ added in v0.12.0
type HeaderTrimRule struct{}
HeaderTrimRule checks that the header has no leading or trailing whitespace.
func (*HeaderTrimRule) Apply ¶ added in v0.12.0
func (r *HeaderTrimRule) Apply(_ lint.RuleSetting) error
func (*HeaderTrimRule) Name ¶ added in v0.12.0
func (r *HeaderTrimRule) Name() string
type ScopeCaseRule ¶ added in v0.12.0
type ScopeCaseRule struct{ Case string }
ScopeCaseRule validates that commit scope matches a given case format. An empty scope is always accepted (scope is optional by convention). Argument: one of the casing.* constants.
func (*ScopeCaseRule) Apply ¶ added in v0.12.0
func (r *ScopeCaseRule) Apply(s lint.RuleSetting) error
func (*ScopeCaseRule) Name ¶ added in v0.12.0
func (r *ScopeCaseRule) Name() string
type ScopeCharsetRule ¶
type ScopeCharsetRule struct{ Charset string }
ScopeCharsetRule to validate charset of scope
func (*ScopeCharsetRule) Apply ¶ added in v0.4.0
func (r *ScopeCharsetRule) Apply(s lint.RuleSetting) error
func (*ScopeCharsetRule) Name ¶
func (r *ScopeCharsetRule) Name() string
type ScopeEmptyRule ¶ added in v0.12.0
type ScopeEmptyRule struct{}
ScopeEmptyRule validates that the commit scope is not empty.
func (*ScopeEmptyRule) Apply ¶ added in v0.12.0
func (r *ScopeEmptyRule) Apply(_ lint.RuleSetting) error
func (*ScopeEmptyRule) Name ¶ added in v0.12.0
func (r *ScopeEmptyRule) Name() string
type ScopeEnumRule ¶
ScopeEnumRule to validate scope against a list of allowed values
func (*ScopeEnumRule) Apply ¶ added in v0.4.0
func (r *ScopeEnumRule) Apply(setting lint.RuleSetting) error
Apply sets the needed argument for the rule
type ScopeMaxLenRule ¶
type ScopeMaxLenRule struct{ CheckLen int }
ScopeMaxLenRule to validate max length of scope
func (*ScopeMaxLenRule) Apply ¶ added in v0.4.0
func (r *ScopeMaxLenRule) Apply(s lint.RuleSetting) error
func (*ScopeMaxLenRule) Name ¶
func (r *ScopeMaxLenRule) Name() string
type ScopeMinLenRule ¶
type ScopeMinLenRule struct{ CheckLen int }
ScopeMinLenRule to validate min length of scope
func (*ScopeMinLenRule) Apply ¶ added in v0.4.0
func (r *ScopeMinLenRule) Apply(s lint.RuleSetting) error
func (*ScopeMinLenRule) Name ¶
func (r *ScopeMinLenRule) Name() string
type SignedOffByRule ¶ added in v0.12.0
type SignedOffByRule struct{ Value string }
SignedOffByRule checks that at least one footer note token matches the configured value (default "Signed-off-by").
func (*SignedOffByRule) Apply ¶ added in v0.12.0
func (r *SignedOffByRule) Apply(s lint.RuleSetting) error
func (*SignedOffByRule) Name ¶ added in v0.12.0
func (r *SignedOffByRule) Name() string
type TrailerExistsRule ¶ added in v0.12.0
type TrailerExistsRule struct{ Value string }
TrailerExistsRule checks that at least one footer note has a token matching the configured value.
This is a generalized version of signed-off-by: any trailer token can be required.
func (*TrailerExistsRule) Apply ¶ added in v0.12.0
func (r *TrailerExistsRule) Apply(s lint.RuleSetting) error
func (*TrailerExistsRule) Name ¶ added in v0.12.0
func (r *TrailerExistsRule) Name() string
type TypeCaseRule ¶ added in v0.12.0
type TypeCaseRule struct{ Case string }
TypeCaseRule validates that commit type matches a given case format. Argument: one of the casing.* constants (e.g. casing.Lower).
func (*TypeCaseRule) Apply ¶ added in v0.12.0
func (r *TypeCaseRule) Apply(s lint.RuleSetting) error
func (*TypeCaseRule) Name ¶ added in v0.12.0
func (r *TypeCaseRule) Name() string
type TypeCharsetRule ¶
type TypeCharsetRule struct{ Charset string }
TypeCharsetRule to validate charset of type
func (*TypeCharsetRule) Apply ¶ added in v0.4.0
func (r *TypeCharsetRule) Apply(s lint.RuleSetting) error
func (*TypeCharsetRule) Name ¶
func (r *TypeCharsetRule) Name() string
type TypeEmptyRule ¶ added in v0.12.0
type TypeEmptyRule struct{}
TypeEmptyRule validates that the commit type is not empty.
func (*TypeEmptyRule) Apply ¶ added in v0.12.0
func (r *TypeEmptyRule) Apply(_ lint.RuleSetting) error
func (*TypeEmptyRule) Name ¶ added in v0.12.0
func (r *TypeEmptyRule) Name() string
type TypeEnumRule ¶
type TypeEnumRule struct {
Types []string
}
TypeEnumRule to validate types
func (*TypeEnumRule) Apply ¶ added in v0.4.0
func (r *TypeEnumRule) Apply(setting lint.RuleSetting) error
Apply sets the needed argument for the rule
type TypeMaxLenRule ¶
type TypeMaxLenRule struct{ CheckLen int }
TypeMaxLenRule to validate max length of type
func (*TypeMaxLenRule) Apply ¶ added in v0.4.0
func (r *TypeMaxLenRule) Apply(s lint.RuleSetting) error
func (*TypeMaxLenRule) Name ¶
func (r *TypeMaxLenRule) Name() string
type TypeMinLenRule ¶
type TypeMinLenRule struct{ CheckLen int }
TypeMinLenRule to validate min length of type
func (*TypeMinLenRule) Apply ¶ added in v0.4.0
func (r *TypeMinLenRule) Apply(s lint.RuleSetting) error
func (*TypeMinLenRule) Name ¶
func (r *TypeMinLenRule) Name() string