MCPcopy Create free account
hub / github.com/conventionalcommit/commitlint / Lint

Method Lint

lint/linter.go:118–131  ·  view source on GitHub ↗

Lint checks the given Commit against rules

(msg Commit)

Source from the content-addressed store, hash-verified

116
117// Lint checks the given Commit against rules
118func (l *Linter) Lint(msg Commit) (*Result, error) {
119 issues := make([]*Issue, 0, len(l.rules))
120
121 for _, rule := range l.rules {
122 currentRule := rule
123 severity := l.conf.GetSeverity(currentRule.Name())
124 issue, isValid := l.runRule(currentRule, severity, msg)
125 if !isValid {
126 issues = append(issues, issue)
127 }
128 }
129
130 return newResult(msg.Message(), issues...), nil
131}
132
133func (l *Linter) runRule(rule Rule, severity Severity, msg Commit) (*Issue, bool) {
134 issue, isValid := rule.Validate(msg)

Callers 1

ParseAndLintMethod · 0.95

Calls 5

runRuleMethod · 0.95
newResultFunction · 0.85
GetSeverityMethod · 0.80
NameMethod · 0.65
MessageMethod · 0.65

Tested by

no test coverage detected