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

mlange-42 / modo / 12758132717

13 Jan 2025 11:36PM CUT coverage: 34.783%. Remained the same
12758132717

push

github

web-flow
Tweak README intro (#32)

264 of 759 relevant lines covered (34.78%)

2.0 hits per line

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

61.54
/document/document.go
1
package document
2

3
import (
4
        "bytes"
5
        "encoding/json"
6
        "unicode"
7
)
8

9
const capitalFileMarker = "-"
10

11
var CaseSensitiveSystem = true
12

13
type Docs struct {
14
        Decl    *Package
15
        Version string
16
}
17

18
type Package struct {
19
        MemberKind
20
        MemberName
21
        Description string
22
        Summary     string
23
        Modules     []*Module
24
        Packages    []*Package
25
}
26

27
type Module struct {
28
        MemberKind
29
        MemberName
30
        Summary     string
31
        Description string
32
        Aliases     []*Alias
33
        Functions   []*Function
34
        Structs     []*Struct
35
        Traits      []*Trait
36
}
37

38
type Alias struct {
39
        MemberKind
40
        MemberName
41
        Description string
42
        Summary     string
43
        Value       string
44
        Deprecated  string
45
}
46

47
type Struct struct {
48
        MemberKind
49
        MemberName
50
        Description  string
51
        Summary      string
52
        Aliases      []*Alias
53
        Constraints  string
54
        Convention   string
55
        Deprecated   string
56
        Fields       []*Field
57
        Functions    []*Function
58
        Parameters   []*Parameter
59
        ParentTraits []string
60
        Signature    string
61
}
62

63
type Function struct {
64
        MemberKind
65
        MemberName
66
        Description          string
67
        Summary              string
68
        Args                 []*Arg
69
        Overloads            []*Function
70
        Async                bool
71
        Constraints          string
72
        Deprecated           string
73
        IsDef                bool
74
        IsStatic             bool
75
        IsImplicitConversion bool
76
        Raises               bool
77
        RaisesDoc            string
78
        ReturnType           string
79
        ReturnsDoc           string
80
        Signature            string
81
        Parameters           []*Parameter
82
}
83

84
type Field struct {
85
        MemberKind
86
        MemberName
87
        Description string
88
        Summary     string
89
        Type        string
90
}
91

92
type Trait struct {
93
        MemberKind
94
        MemberName
95
        Description  string
96
        Summary      string
97
        Fields       []*Field
98
        Functions    []*Function
99
        ParentTraits []string
100
        Deprecated   string
101
}
102

103
type Arg struct {
104
        MemberKind
105
        MemberName
106
        Description string
107
        Convention  string
108
        Type        string
109
        PassingKind string
110
        Default     string
111
}
112

113
type Parameter struct {
114
        MemberKind
115
        MemberName
116
        Description string
117
        Type        string
118
        PassingKind string
119
        Default     string
120
}
121

122
func FromJson(data []byte) (*Docs, error) {
1✔
123
        reader := bytes.NewReader(data)
1✔
124
        dec := json.NewDecoder(reader)
1✔
125
        dec.DisallowUnknownFields()
1✔
126

1✔
127
        var docs Docs
1✔
128

1✔
129
        if err := dec.Decode(&docs); err != nil {
1✔
130
                return nil, err
×
131
        }
×
132

133
        cleanup(&docs)
1✔
134

1✔
135
        return &docs, nil
1✔
136
}
137

138
type Kinded interface {
139
        GetKind() string
140
}
141

142
type Named interface {
143
        GetName() string
144
        GetFileName() string
145
}
146

147
type MemberKind struct {
148
        Kind string
149
}
150

151
func NewKind(kind string) MemberKind {
12✔
152
        return MemberKind{Kind: kind}
12✔
153
}
12✔
154

155
func (k *MemberKind) GetKind() string {
×
156
        return k.Kind
×
157
}
×
158

159
type MemberName struct {
160
        Name string
161
}
162

163
func NewName(name string) MemberName {
25✔
164
        return MemberName{Name: name}
25✔
165
}
25✔
166

167
func (k *MemberName) GetName() string {
26✔
168
        return k.Name
26✔
169
}
26✔
170

171
func (k *MemberName) GetFileName() string {
6✔
172
        if CaseSensitiveSystem {
12✔
173
                return k.Name
6✔
174
        }
6✔
175
        if isCap(k.Name) {
×
176
                return k.Name + capitalFileMarker
×
177
        }
×
178
        return k.Name
×
179
}
180

181
func isCap(s string) bool {
×
182
        if len(s) == 0 {
×
183
                return false
×
184
        }
×
185
        firstRune := []rune(s)[0]
×
186
        return unicode.IsUpper(firstRune)
×
187
}
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