Skip to content
2 changes: 1 addition & 1 deletion eng/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
run:
# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true
skip-dirs-use-default: true
2 changes: 1 addition & 1 deletion eng/pipelines/templates/steps/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ steps:
env:
GO111MODULE: 'on'

- pwsh: ../eng/scripts/create_coverage.ps1
- pwsh: ../eng/scripts/create_coverage.ps1 ${{parameters.ServiceDirectory}}
displayName: 'Generate Coverage XML'
workingDirectory: '${{parameters.GoWorkspace}}sdk'

Expand Down
8 changes: 7 additions & 1 deletion eng/scripts/create_coverage.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#Requires -Version 7.0

Param(
[string] $serviceDirectory
)

Write-Host $serviceDirectory

$coverageFiles = [Collections.Generic.List[String]]@()
Get-ChildItem -recurse -path . -filter coverage.txt | ForEach-Object {
$covFile = $_.FullName
Expand All @@ -16,4 +22,4 @@ Get-Content ./coverage.json | gocov-xml > ./coverage.xml
Get-Content ./coverage.json | gocov-html > ./coverage.html

# use internal tool to fail if coverage is too low
go run ../tools/internal/coverage/main.go
go run ../tools/internal/coverage/main.go -serviceDirectory $serviceDirectory
2 changes: 2 additions & 0 deletions sdk/azcore/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ trigger:
paths:
include:
- sdk/azcore/
- eng/

pr:
paths:
include:
- sdk/azcore/
- eng/


stages:
Expand Down
4 changes: 2 additions & 2 deletions sdk/azcore/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ func (l *Logger) Writef(cls LogClassification, format string, a ...interface{})
l.lst(cls, fmt.Sprintf(format, a...))
}

// for testing purposes
func (l *Logger) resetClassifications() {
// for testing purposes, nolint is a false positive
func (l *Logger) resetClassifications() { //nolint:unused
l.cls = nil
}

Expand Down
7 changes: 6 additions & 1 deletion tools/internal/coverage/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
Expand Down Expand Up @@ -79,14 +80,18 @@ func findCoverageGoal(covFiles []string, configData *CodeCoverage) float64 {
}

func main() {

serviceDir := flag.String("serviceDirectory", "", "Service Directory")
flag.Parse()

coverageFiles = make([]string, 0)
rootPath, err := filepath.Abs(".")
check(err)

FindCoverageFiles(rootPath)

configData := ReadConfigData()
coverageGoal := findCoverageGoal(coverageFiles, configData)
coverageGoal := findCoverageGoal([]string{*serviceDir}, configData)

fmt.Printf("Failing if the coverage is below %.2f\n", coverageGoal)

Expand Down