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

charmbracelet / glow / 9781288045

03 Jul 2024 04:09PM UTC coverage: 10.177% (+0.04%) from 10.134%
9781288045

Pull #450

github

web-flow
Merge branch 'master' into readme
Pull Request #450: fix: check other possible readme paths/branches

12 of 28 new or added lines in 2 files covered. (42.86%)

190 of 1867 relevant lines covered (10.18%)

4.65 hits per line

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

20.69
/gitlab.go
1
package main
2

3
import (
4
        "errors"
5
        "fmt"
6
        "net/http"
7
        "net/url"
8
        "strings"
9
)
10

11
// isGitLabURL tests a string to determine if it is a well-structured GitLab URL.
12
func isGitLabURL(s string) (string, bool) {
2✔
13
        if strings.HasPrefix(s, "gitlab.com/") {
2✔
14
                s = "https://" + s
×
15
        }
×
16

17
        u, err := url.ParseRequestURI(s)
2✔
18
        if err != nil {
4✔
19
                return "", false
2✔
20
        }
2✔
21

22
        return u.String(), strings.ToLower(u.Host) == "gitlab.com"
×
23
}
24

25
// findGitLabREADME tries to find the correct README filename in a repository.
26
func findGitLabREADME(s string) (*source, error) {
×
27
        u, err := url.ParseRequestURI(s)
×
28
        if err != nil {
×
29
                return nil, err
×
30
        }
×
31

NEW
32
        for _, b := range readmeBranches {
×
NEW
33
                for _, r := range readmeNames {
×
NEW
34
                        v := *u
×
NEW
35
                        v.Path += fmt.Sprintf("/raw/%s/%s", b, r)
×
NEW
36

×
NEW
37
                        // nolint:bodyclose
×
NEW
38
                        // it is closed on the caller
×
NEW
39
                        resp, err := http.Get(v.String())
×
NEW
40
                        if err != nil {
×
NEW
41
                                return nil, err
×
NEW
42
                        }
×
43

NEW
44
                        if resp.StatusCode == http.StatusOK {
×
NEW
45
                                return &source{resp.Body, v.String()}, nil
×
NEW
46
                        }
×
47
                }
48
        }
49

50
        return nil, errors.New("can't find README in GitLab repository")
×
51
}
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

© 2026 Coveralls, Inc