• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

thumbrise / commitlint-scope / 27126538804

08 Jun 2026 08:52AM UTC coverage: 59.466% (+5.3%) from 54.213%
27126538804

push

github

thumbrise
fix: Sort outsiders, harden config test, clarify intersection in docs

- Sort findOutsiders result by File (non-deterministic map iteration)
- Assert ScopeSeparator unconditionally in config tests
- Rewrite README multi-scope section with explicit intersection semantics

3 of 3 new or added lines in 1 file covered. (100.0%)

25 existing lines in 4 files now uncovered.

245 of 412 relevant lines covered (59.47%)

0.69 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.12
/pkg/validator/scope_parser.go
1
package validator
2

3
import (
4
        "regexp"
5
        "strings"
6
)
7

8
const scopeRegexGroup = "scope"
9

10
type DefaultScopeParser struct {
11
        scopeRegex *regexp.Regexp
12
        separator  string
13
}
14

15
func NewDefaultScopeParser(scopeRegex *regexp.Regexp, separator string) *DefaultScopeParser {
1✔
16
        if separator == "" {
2✔
17
                separator = ","
1✔
18
        }
1✔
19

20
        return &DefaultScopeParser{scopeRegex: scopeRegex, separator: separator}
1✔
21
}
22

23
func (p *DefaultScopeParser) Parse(message string) []string {
1✔
24
        regex := p.scopeRegex
1✔
25
        if regex == nil {
2✔
26
                return nil
1✔
27
        }
1✔
28

29
        matches := regex.FindStringSubmatch(message)
1✔
30
        if matches == nil {
2✔
31
                return nil
1✔
32
        }
1✔
33

34
        idx := regex.SubexpIndex(scopeRegexGroup)
1✔
35
        if idx < 0 || idx >= len(matches) {
2✔
36
                return nil
1✔
37
        }
1✔
38

39
        raw := matches[idx]
1✔
40
        if raw == "" {
2✔
41
                return nil
1✔
42
        }
1✔
43

44
        parts := strings.Split(raw, p.separator)
1✔
45

1✔
46
        scopes := make([]string, 0, len(parts))
1✔
47
        for _, part := range parts {
2✔
48
                s := strings.TrimSpace(part)
1✔
49
                if s != "" {
2✔
50
                        scopes = append(scopes, s)
1✔
51
                }
1✔
52
        }
53

54
        if len(scopes) == 0 {
1✔
UNCOV
55
                return nil
×
UNCOV
56
        }
×
57

58
        return scopes
1✔
59
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc