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

mlange-42 / modo / 12810176069

16 Jan 2025 01:43PM CUT coverage: 36.569% (+1.8%) from 34.803%
12810176069

push

github

web-flow
Implement re-exports on package level (#42)

235 of 505 new or added lines in 11 files covered. (46.53%)

41 existing lines in 4 files now uncovered.

437 of 1195 relevant lines covered (36.57%)

2.65 hits per line

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

89.61
/document/paths.go
1
package document
2

3
import "strings"
4

5
type elemPath struct {
6
        Elements  []string
7
        Kind      string
8
        IsSection bool
9
}
10

11
func (proc *Processor) collectPaths() {
1✔
12
        proc.linkTargets = map[string]elemPath{}
1✔
13
        proc.collectPathsPackage(proc.ExportDocs.Decl, []string{}, []string{})
1✔
14
}
1✔
15

16
func (proc *Processor) collectPathsPackage(p *Package, elems []string, pathElem []string) {
2✔
17
        newElems := appendNew(elems, p.GetName())
2✔
18
        newPath := appendNew(pathElem, p.GetFileName())
2✔
19
        proc.linkTargets[strings.Join(newElems, ".")] = elemPath{Elements: newPath, Kind: "package", IsSection: false}
2✔
20

2✔
21
        for _, pkg := range p.Packages {
3✔
22
                proc.collectPathsPackage(pkg, newElems, newPath)
1✔
23
        }
1✔
24
        for _, mod := range p.Modules {
3✔
25
                proc.collectPathsModule(mod, newElems, newPath)
1✔
26
        }
1✔
27

28
        for _, s := range p.Structs {
2✔
NEW
29
                proc.collectPathsStruct(s, newElems, newPath)
×
NEW
30
        }
×
31
        for _, t := range p.Traits {
2✔
NEW
32
                proc.collectPathsTrait(t, newElems, newPath)
×
NEW
33
        }
×
34
        for _, f := range p.Functions {
2✔
NEW
35
                newElems := appendNew(newElems, f.GetName())
×
NEW
36
                newPath := appendNew(newPath, f.GetFileName())
×
NEW
37
                proc.linkTargets[strings.Join(newElems, ".")] = elemPath{Elements: newPath, Kind: "member", IsSection: false}
×
UNCOV
38
        }
×
39
}
40

41
func (proc *Processor) collectPathsModule(m *Module, elems []string, pathElem []string) {
1✔
42
        newElems := appendNew(elems, m.GetName())
1✔
43
        newPath := appendNew(pathElem, m.GetFileName())
1✔
44
        proc.linkTargets[strings.Join(newElems, ".")] = elemPath{Elements: newPath, Kind: "module", IsSection: false}
1✔
45

1✔
46
        for _, s := range m.Structs {
2✔
47
                proc.collectPathsStruct(s, newElems, newPath)
1✔
48
        }
1✔
49
        for _, t := range m.Traits {
2✔
50
                proc.collectPathsTrait(t, newElems, newPath)
1✔
51
        }
1✔
52
        for _, f := range m.Functions {
2✔
53
                newElems := appendNew(newElems, f.GetName())
1✔
54
                newPath := appendNew(newPath, f.GetFileName())
1✔
55
                proc.linkTargets[strings.Join(newElems, ".")] = elemPath{Elements: newPath, Kind: "member", IsSection: false}
1✔
56
        }
1✔
57
}
58

59
func (proc *Processor) collectPathsStruct(s *Struct, elems []string, pathElem []string) {
1✔
60
        newElems := appendNew(elems, s.GetName())
1✔
61
        newPath := appendNew(pathElem, s.GetFileName())
1✔
62
        proc.linkTargets[strings.Join(newElems, ".")] = elemPath{Elements: newPath, Kind: "member", IsSection: false}
1✔
63

1✔
64
        for _, f := range s.Parameters {
2✔
65
                newElems := appendNew(newElems, f.GetName())
1✔
66
                newPath := appendNew(newPath, "#parameters")
1✔
67
                proc.linkTargets[strings.Join(newElems, ".")] = elemPath{Elements: newPath, Kind: "member", IsSection: true}
1✔
68
        }
1✔
69
        for _, f := range s.Fields {
2✔
70
                newElems := appendNew(newElems, f.GetName())
1✔
71
                newPath := appendNew(newPath, "#fields")
1✔
72
                proc.linkTargets[strings.Join(newElems, ".")] = elemPath{Elements: newPath, Kind: "member", IsSection: true}
1✔
73
        }
1✔
74
        for _, f := range s.Functions {
2✔
75
                newElems := appendNew(newElems, f.GetName())
1✔
76
                newPath := appendNew(newPath, "#"+strings.ToLower(f.GetName()))
1✔
77
                proc.linkTargets[strings.Join(newElems, ".")] = elemPath{Elements: newPath, Kind: "member", IsSection: true}
1✔
78
        }
1✔
79
}
80

81
func (proc *Processor) collectPathsTrait(t *Trait, elems []string, pathElem []string) {
1✔
82
        newElems := appendNew(elems, t.GetName())
1✔
83
        newPath := appendNew(pathElem, t.GetFileName())
1✔
84
        proc.linkTargets[strings.Join(newElems, ".")] = elemPath{Elements: newPath, Kind: "member", IsSection: false}
1✔
85

1✔
86
        for _, f := range t.Fields {
2✔
87
                newElems := appendNew(newElems, f.GetName())
1✔
88
                newPath := appendNew(newPath, "#fields")
1✔
89
                proc.linkTargets[strings.Join(newElems, ".")] = elemPath{Elements: newPath, Kind: "member", IsSection: true}
1✔
90
        }
1✔
91
        for _, f := range t.Functions {
2✔
92
                newElems := appendNew(newElems, f.GetName())
1✔
93
                newPath := appendNew(newPath, "#"+strings.ToLower(f.GetName()))
1✔
94
                proc.linkTargets[strings.Join(newElems, ".")] = elemPath{Elements: newPath, Kind: "member", IsSection: true}
1✔
95
        }
1✔
96
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc