Skip to content

Commit

Permalink
Exclude changelogs from base coverage reports (#1962)
Browse files Browse the repository at this point in the history
These files are frequently modified and not usually relevant to tests.
When modified, they appear as not covered in the reports. With this
change we avoid showing them in the reports.
If in the future they are used by some test, we can add the coverage
there.
  • Loading branch information
jsoriano authored Jul 11, 2024
1 parent 034aefe commit 74796df
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/testrunner/coverage.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ func GenerateBasePackageCoverageReport(pkgName, rootPath, format string) (Covera
return nil
}

// Exclude changelog from coverage reports, as changelogs are frequently modified and not
// relevant to tests.
if d.Name() == "changelog.yml" && filepath.Dir(match) == filepath.Clean(rootPath) {
return nil
}

fileCoverage, err := generateBaseFileCoverageReport(repoPath, pkgName, match, format, false)
if err != nil {
return fmt.Errorf("failed to generate base coverage for \"%s\": %w", match, err)
Expand Down

0 comments on commit 74796df

Please sign in to comment.