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

mlange-42 / modo / 12777767016

14 Jan 2025 10:46PM CUT coverage: 34.058% (+0.2%) from 33.894%
12777767016

Pull #39

github

web-flow
Merge 12e54bf0f into efc472466
Pull Request #39: Move the binary package to module root

0 of 60 new or added lines in 3 files covered. (0.0%)

282 of 828 relevant lines covered (34.06%)

2.1 hits per line

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

100.0
/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(doc *Docs) map[string]elemPath {
1✔
12
        out := map[string]elemPath{}
1✔
13
        proc.collectPathsPackage(doc.Decl, []string{}, []string{}, out)
1✔
14
        return out
1✔
15
}
1✔
16

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

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

30
func (proc *Processor) collectPathsModule(m *Module, elems []string, pathElem []string, out map[string]elemPath) {
1✔
31
        newElems := appendNew(elems, m.GetName())
1✔
32
        newPath := appendNew(pathElem, m.GetFileName())
1✔
33
        out[strings.Join(newElems, ".")] = elemPath{Elements: newPath, Kind: "module", IsSection: false}
1✔
34

1✔
35
        for _, s := range m.Structs {
2✔
36
                proc.collectPathsStruct(s, newElems, newPath, out)
1✔
37
        }
1✔
38
        for _, t := range m.Traits {
2✔
39
                proc.collectPathsTrait(t, newElems, newPath, out)
1✔
40
        }
1✔
41
        for _, f := range m.Functions {
2✔
42
                newElems := appendNew(newElems, f.GetName())
1✔
43
                newPath := appendNew(newPath, f.GetFileName())
1✔
44
                out[strings.Join(newElems, ".")] = elemPath{Elements: newPath, Kind: "member", IsSection: false}
1✔
45
        }
1✔
46
}
47

48
func (proc *Processor) collectPathsStruct(s *Struct, elems []string, pathElem []string, out map[string]elemPath) {
1✔
49
        newElems := appendNew(elems, s.GetName())
1✔
50
        newPath := appendNew(pathElem, s.GetFileName())
1✔
51
        out[strings.Join(newElems, ".")] = elemPath{Elements: newPath, Kind: "member", IsSection: false}
1✔
52

1✔
53
        for _, f := range s.Parameters {
2✔
54
                newElems := appendNew(newElems, f.GetName())
1✔
55
                newPath := appendNew(newPath, "#parameters")
1✔
56
                out[strings.Join(newElems, ".")] = elemPath{Elements: newPath, Kind: "member", IsSection: true}
1✔
57
        }
1✔
58
        for _, f := range s.Fields {
2✔
59
                newElems := appendNew(newElems, f.GetName())
1✔
60
                newPath := appendNew(newPath, "#fields")
1✔
61
                out[strings.Join(newElems, ".")] = elemPath{Elements: newPath, Kind: "member", IsSection: true}
1✔
62
        }
1✔
63
        for _, f := range s.Functions {
2✔
64
                newElems := appendNew(newElems, f.GetName())
1✔
65
                newPath := appendNew(newPath, "#"+strings.ToLower(f.GetName()))
1✔
66
                out[strings.Join(newElems, ".")] = elemPath{Elements: newPath, Kind: "member", IsSection: true}
1✔
67
        }
1✔
68
}
69

70
func (proc *Processor) collectPathsTrait(t *Trait, elems []string, pathElem []string, out map[string]elemPath) {
1✔
71
        newElems := appendNew(elems, t.GetName())
1✔
72
        newPath := appendNew(pathElem, t.GetFileName())
1✔
73
        out[strings.Join(newElems, ".")] = elemPath{Elements: newPath, Kind: "member", IsSection: false}
1✔
74

1✔
75
        for _, f := range t.Fields {
2✔
76
                newElems := appendNew(newElems, f.GetName())
1✔
77
                newPath := appendNew(newPath, "#fields")
1✔
78
                out[strings.Join(newElems, ".")] = elemPath{Elements: newPath, Kind: "member", IsSection: true}
1✔
79
        }
1✔
80
        for _, f := range t.Functions {
2✔
81
                newElems := appendNew(newElems, f.GetName())
1✔
82
                newPath := appendNew(newPath, "#"+strings.ToLower(f.GetName()))
1✔
83
                out[strings.Join(newElems, ".")] = elemPath{Elements: newPath, Kind: "member", IsSection: true}
1✔
84
        }
1✔
85
}
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