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

Function TestLintRecoveredIssues

test/syntax_inspection_test.go:12–41  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestLintRecoveredIssues(t *testing.T) {
13 conf := config.NewDefault()
14 conf.Rules = []string{"type-enum", "body-leading-blank", "body-max-line-length", "header-trim"}
15 conf.Settings["body-max-line-length"] = lint.RuleSetting{Argument: 10}
16 conf.Severity.Default = lint.SeverityWarn
17 linter, err := config.NewLinter(conf)
18 if err != nil {
19 t.Fatal(err)
20 }
21 input := " unknown:expose records\n" + strings.Repeat("x", 11)
22 result, err := linter.ParseAndLint(input)
23 if err != nil {
24 t.Fatal(err)
25 }
26 want := []string{"parser", "parser", "parser", "type-enum", "body-leading-blank", "body-max-line-length", "header-trim"}
27 var rules []string
28 for _, issue := range result.Issues() {
29 rules = append(rules, issue.RuleName())
30 severity := lint.SeverityWarn
31 if issue.RuleName() == "parser" {
32 severity = lint.SeverityError
33 }
34 if issue.Severity() != severity {
35 t.Fatalf("severity=%s for %s", issue.Severity(), issue.RuleName())
36 }
37 }
38 if !reflect.DeepEqual(rules, want) || result.Input() != input {
39 t.Fatalf("rules=%v, want %v", rules, want)
40 }
41}
42
43func TestLintAmbiguousHeaderSkipsRules(t *testing.T) {
44 conf := config.NewDefault()

Callers

nothing calls this directly

Calls 7

ParseAndLintMethod · 0.95
NewDefaultFunction · 0.92
NewLinterFunction · 0.92
IssuesMethod · 0.80
RuleNameMethod · 0.80
SeverityMethod · 0.80
InputMethod · 0.80

Tested by

no test coverage detected