MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / Coveralls

Method Coveralls

tools/mage/go.go:239–280  ·  view source on GitHub ↗

Coveralls sends the test coverage to Coveralls.

()

Source from the content-addressed store, hash-verified

237
238// Coveralls sends the test coverage to Coveralls.
239func (g Go) Coveralls() error {
240 mg.Deps(g.Cover)
241 if mg.Verbose() {
242 fmt.Println("Filtering Go coverage output")
243 }
244 inFile, err := os.Open(goCoverageFile)
245 if err != nil {
246 return err
247 }
248 outFile, err := os.OpenFile("coveralls_"+goCoverageFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o644)
249 if err != nil {
250 return err
251 }
252 defer func() {
253 outFile.Close()
254 os.Remove("coveralls_" + goCoverageFile)
255 }()
256 s := bufio.NewScanner(inFile)
257nextLine:
258 for s.Scan() {
259 line := s.Text()
260 for _, suffix := range coverallsIgnored {
261 if strings.Contains(line, suffix) {
262 continue nextLine
263 }
264 }
265 if _, err = fmt.Fprintln(outFile, line); err != nil {
266 return err
267 }
268 }
269 if err = outFile.Close(); err != nil {
270 return err
271 }
272 service := os.Getenv("COVERALLS_SERVICE")
273 if service == "" {
274 service = "github"
275 }
276 if mg.Verbose() {
277 fmt.Println("Sending Go coverage to Coveralls")
278 }
279 return runGoTool(goveralls, "-coverprofile=coveralls_"+goCoverageFile, "-service="+service)
280}
281
282// Generate runs go generate.
283func (Go) Generate() error {

Callers

nothing calls this directly

Calls 5

runGoToolFunction · 0.85
RemoveMethod · 0.80
CloseMethod · 0.65
ContainsMethod · 0.65
DepsMethod · 0.45

Tested by

no test coverage detected