• 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

85.71
/document/cleanup.go
1
package document
2

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

8
func cleanup(doc *Docs) {
2✔
9
        cleanupPackage(doc.Decl)
2✔
10
}
2✔
11

12
func cleanupPackage(p *Package) {
2✔
13
        for _, pp := range p.Packages {
2✔
14
                cleanupPackage(pp)
×
15
        }
×
16
        newModules := make([]*Module, 0, len(p.Modules))
2✔
17
        for _, m := range p.Modules {
4✔
18
                cleanupModule(m)
2✔
19
                if m.GetName() != "__init__" {
3✔
20
                        newModules = append(newModules, m)
1✔
21
                }
1✔
22
        }
23
        p.Modules = newModules
2✔
24
}
25

26
func cleanupModule(m *Module) {
2✔
27
        for _, s := range m.Structs {
2✔
28
                if s.Signature == "" {
×
29
                        s.Signature = createSignature(s)
×
30
                }
×
31
        }
32
}
33

34
func createSignature(s *Struct) string {
4✔
35
        b := strings.Builder{}
4✔
36
        b.WriteString("struct ")
4✔
37
        b.WriteString(s.GetName())
4✔
38

4✔
39
        if len(s.Parameters) == 0 {
4✔
40
                return b.String()
×
41
        }
×
42

43
        b.WriteString("[")
4✔
44

4✔
45
        prevKind := ""
4✔
46
        for i, par := range s.Parameters {
11✔
47
                written := false
7✔
48
                if par.PassingKind == "kw" && prevKind != par.PassingKind {
9✔
49
                        if i > 0 {
3✔
50
                                b.WriteString(", ")
1✔
51
                        }
1✔
52
                        b.WriteString("*")
2✔
53
                        written = true
2✔
54
                }
55
                if prevKind == "inferred" && par.PassingKind != prevKind {
8✔
56
                        b.WriteString(", //")
1✔
57
                        written = true
1✔
58
                }
1✔
59
                if prevKind == "pos" && par.PassingKind != prevKind {
8✔
60
                        b.WriteString(", /")
1✔
61
                        written = true
1✔
62
                }
1✔
63

64
                if i > 0 || written {
11✔
65
                        b.WriteString(", ")
4✔
66
                }
4✔
67

68
                b.WriteString(fmt.Sprintf("%s: %s", par.GetName(), par.Type))
7✔
69
                if len(par.Default) > 0 {
7✔
70
                        b.WriteString(fmt.Sprintf(" = %s", par.Default))
×
71
                }
×
72

73
                prevKind = par.PassingKind
7✔
74
        }
75
        if prevKind == "inferred" {
5✔
76
                b.WriteString(", //")
1✔
77
        }
1✔
78
        if prevKind == "pos" {
5✔
79
                b.WriteString(", /")
1✔
80
        }
1✔
81

82
        b.WriteString("]")
4✔
83

4✔
84
        return b.String()
4✔
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