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

Function TestLint_CustomWarningSeverity

test/lint_test.go:209–232  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

207}
208
209func TestLint_CustomWarningSeverity(t *testing.T) {
210 conf := config.NewDefault()
211 conf.Severity.Rules = map[string]lint.Severity{
212 "type-enum": lint.SeverityWarn,
213 }
214 rules, err := config.GetEnabledRules(conf)
215 if err != nil {
216 t.Fatal(err)
217 }
218 linter, err := lint.New(conf, rules)
219 if err != nil {
220 t.Fatal(err)
221 }
222
223 result, err := linter.ParseAndLint("unknown: some message here")
224 if err != nil {
225 t.Fatal(err)
226 }
227 for _, iss := range result.Issues() {
228 if iss.RuleName() == "type-enum" && iss.Severity() != lint.SeverityWarn {
229 t.Errorf("expected warn for type-enum, got %q", iss.Severity())
230 }
231 }
232}
233
234func TestLint_ParserErrorAlwaysError(t *testing.T) {
235 conf := config.NewDefault()

Callers

nothing calls this directly

Calls 7

NewDefaultFunction · 0.92
GetEnabledRulesFunction · 0.92
NewFunction · 0.92
ParseAndLintMethod · 0.80
IssuesMethod · 0.80
RuleNameMethod · 0.80
SeverityMethod · 0.80

Tested by

no test coverage detected