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

mlange-42 / modo / 12855871165

19 Jan 2025 05:55PM CUT coverage: 58.921% (-0.03%) from 58.946%
12855871165

push

github

web-flow
Strict mode, check re-exports (#68)

80 of 109 new or added lines in 7 files covered. (73.39%)

5 existing lines in 1 file now uncovered.

819 of 1390 relevant lines covered (58.92%)

7.89 hits per line

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

92.59
/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
// Collects lookup for link target paths.
12
// Runs on the re-structured package.
13
func (proc *Processor) collectPaths() {
5✔
14
        proc.linkTargets = map[string]elemPath{}
5✔
15
        proc.collectPathsPackage(proc.ExportDocs.Decl, []string{}, []string{}, proc.addLinkTarget)
5✔
16
}
5✔
17

18
// Collects the paths of all (sub)-elements in the original structure.
19
func (proc *Processor) collectElementPaths() {
4✔
20
        proc.allPaths = map[string]bool{}
4✔
21
        proc.collectPathsPackage(proc.Docs.Decl, []string{}, []string{}, proc.addElementPath)
4✔
22
}
4✔
23

24
func (proc *Processor) collectPathsPackage(p *Package, elems []string, pathElem []string, add func([]string, []string, string, bool)) {
10✔
25
        newElems := appendNew(elems, p.GetName())
10✔
26
        newPath := appendNew(pathElem, p.GetFileName())
10✔
27
        add(newElems, newPath, "package", false)
10✔
28

10✔
29
        for _, pkg := range p.Packages {
11✔
30
                proc.collectPathsPackage(pkg, newElems, newPath, add)
1✔
31
        }
1✔
32
        for _, mod := range p.Modules {
20✔
33
                proc.collectPathsModule(mod, newElems, newPath, add)
10✔
34
        }
10✔
35

36
        for _, s := range p.Structs {
11✔
37
                proc.collectPathsStruct(s, newElems, newPath, add)
1✔
38
        }
1✔
39
        for _, t := range p.Traits {
10✔
NEW
40
                proc.collectPathsTrait(t, newElems, newPath, add)
×
41
        }
×
42
        for _, f := range p.Functions {
10✔
43
                newElems := appendNew(newElems, f.GetName())
×
44
                newPath := appendNew(newPath, f.GetFileName())
×
NEW
45
                add(newElems, newPath, "function", false)
×
46
        }
×
47
}
48

49
func (proc *Processor) collectPathsModule(m *Module, elems []string, pathElem []string, add func([]string, []string, string, bool)) {
10✔
50
        newElems := appendNew(elems, m.GetName())
10✔
51
        newPath := appendNew(pathElem, m.GetFileName())
10✔
52
        add(newElems, newPath, "module", false)
10✔
53

10✔
54
        for _, s := range m.Structs {
16✔
55
                proc.collectPathsStruct(s, newElems, newPath, add)
6✔
56
        }
6✔
57
        for _, t := range m.Traits {
15✔
58
                proc.collectPathsTrait(t, newElems, newPath, add)
5✔
59
        }
5✔
60
        for _, f := range m.Functions {
15✔
61
                newElems := appendNew(newElems, f.GetName())
5✔
62
                newPath := appendNew(newPath, f.GetFileName())
5✔
63
                add(newElems, newPath, "function", false)
5✔
64
        }
5✔
65
}
66

67
func (proc *Processor) collectPathsStruct(s *Struct, elems []string, pathElem []string, add func([]string, []string, string, bool)) {
7✔
68
        newElems := appendNew(elems, s.GetName())
7✔
69
        newPath := appendNew(pathElem, s.GetFileName())
7✔
70
        add(newElems, newPath, "struct", false)
7✔
71

7✔
72
        for _, f := range s.Parameters {
10✔
73
                newElems := appendNew(newElems, f.GetName())
3✔
74
                newPath := appendNew(newPath, "#parameters")
3✔
75
                add(newElems, newPath, "member", true)
3✔
76
        }
3✔
77
        for _, f := range s.Fields {
12✔
78
                newElems := appendNew(newElems, f.GetName())
5✔
79
                newPath := appendNew(newPath, "#fields")
5✔
80
                add(newElems, newPath, "member", true)
5✔
81
        }
5✔
82
        for _, f := range s.Functions {
10✔
83
                newElems := appendNew(newElems, f.GetName())
3✔
84
                newPath := appendNew(newPath, "#"+strings.ToLower(f.GetName()))
3✔
85
                add(newElems, newPath, "member", true)
3✔
86
        }
3✔
87
}
88

89
func (proc *Processor) collectPathsTrait(t *Trait, elems []string, pathElem []string, add func([]string, []string, string, bool)) {
5✔
90
        newElems := appendNew(elems, t.GetName())
5✔
91
        newPath := appendNew(pathElem, t.GetFileName())
5✔
92
        add(newElems, newPath, "trait", false)
5✔
93

5✔
94
        for _, f := range t.Fields {
8✔
95
                newElems := appendNew(newElems, f.GetName())
3✔
96
                newPath := appendNew(newPath, "#fields")
3✔
97
                add(newElems, newPath, "member", true)
3✔
98
        }
3✔
99
        for _, f := range t.Functions {
8✔
100
                newElems := appendNew(newElems, f.GetName())
3✔
101
                newPath := appendNew(newPath, "#"+strings.ToLower(f.GetName()))
3✔
102
                add(newElems, newPath, "member", true)
3✔
103
        }
3✔
104
}
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