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

mlange-42 / modo / 12811333482

16 Jan 2025 02:46PM CUT coverage: 37.068% (+0.2%) from 36.851%
12811333482

Pull #44

github

web-flow
Merge 29af9681f into 6f7c9c303
Pull Request #44: Improve code structure

26 of 94 new or added lines in 5 files covered. (27.66%)

12 existing lines in 2 files now uncovered.

450 of 1214 relevant lines covered (37.07%)

2.7 hits per line

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

45.45
/document/processor.go
1
package document
2

3
import (
4
        "strings"
5
        "text/template"
6
)
7

8
type Processor struct {
9
        Template    *template.Template
10
        Formatter   Formatter
11
        UseExports  bool
12
        ShortLinks  bool
13
        Docs        *Docs
14
        ExportDocs  *Docs
15
        linkTargets map[string]elemPath
16
        linkExports map[string]string
17
}
18

19
func NewProcessor(docs *Docs, f Formatter, t *template.Template, useExports bool, shortLinks bool) Processor {
5✔
20
        return Processor{
5✔
21
                Template:   t,
5✔
22
                Formatter:  f,
5✔
23
                UseExports: useExports,
5✔
24
                ShortLinks: shortLinks,
5✔
25
                Docs:       docs,
5✔
26
        }
5✔
27
}
5✔
28

29
// PrepareDocs processes the API docs for subsequent rendering.
NEW
30
func (proc *Processor) PrepareDocs() error {
×
NEW
31
        err := proc.filterPackages()
×
NEW
32
        if err != nil {
×
NEW
33
                return err
×
NEW
34
        }
×
NEW
35
        proc.collectPaths()
×
NEW
36

×
NEW
37
        if !proc.UseExports {
×
NEW
38
                for k := range proc.linkTargets {
×
NEW
39
                        proc.linkExports[k] = k
×
NEW
40
                }
×
41
        }
NEW
42
        if err := proc.processLinksPackage(proc.Docs.Decl, []string{}, true); err != nil {
×
NEW
43
                return err
×
NEW
44
        }
×
NEW
45
        if err := proc.processLinksPackage(proc.ExportDocs.Decl, []string{}, false); err != nil {
×
NEW
46
                return err
×
NEW
47
        }
×
NEW
48
        return nil
×
49
}
50

51
func (proc *Processor) addLinkExport(oldPath, newPath []string) {
14✔
52
        proc.linkExports[strings.Join(oldPath, ".")] = strings.Join(newPath, ".")
14✔
53
}
14✔
54

55
func (proc *Processor) addLinkTarget(elPath, filePath []string, kind string, isSection bool) {
11✔
56
        proc.linkTargets[strings.Join(elPath, ".")] = elemPath{Elements: filePath, Kind: kind, IsSection: isSection}
11✔
57
}
11✔
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