MCPcopy Index your code
hub / github.com/conventionalcommit/commitlint / Lint

Method Lint

lint/linter.go:78–91  ·  view source on GitHub ↗

Lint checks the given Commit against rules

(msg Commit)

Source from the content-addressed store, hash-verified

76
77// Lint checks the given Commit against rules
78func (l *Linter) Lint(msg Commit) (*Result, error) {
79 issues := make([]*Issue, 0, len(l.rules))
80
81 for _, rule := range l.rules {
82 currentRule := rule
83 severity := l.conf.GetSeverity(currentRule.Name())
84 issue, isValid := l.runRule(currentRule, severity, msg)
85 if !isValid {
86 issues = append(issues, issue)
87 }
88 }
89
90 return newResult(msg.Message(), issues...), nil
91}
92
93func (l *Linter) runRule(rule Rule, severity Severity, msg Commit) (*Issue, bool) {
94 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