-
-
Notifications
You must be signed in to change notification settings - Fork 28
report when overall threshold present (or) overrides are present #141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
5e8035d
60426fa
aa2be83
1313a75
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -74,12 +74,18 @@ | |
| } | ||
|
|
||
| func Analyze(cfg Config, current, base []coverage.Stats) AnalyzeResult { | ||
| var hasFileOverrides, hasPackageOverrides bool | ||
| thr := cfg.Threshold | ||
| overrideRules, hasOverrides := compileOverridePathRules(cfg) | ||
| overrideRules := compileOverridePathRules(cfg) | ||
|
|
||
| if len(cfg.Override) > 0 { | ||
| hasFileOverrides, hasPackageOverrides = detectOverrides(cfg.Override) | ||
| } | ||
|
|
||
| return AnalyzeResult{ | ||
| Threshold: thr, | ||
| HasOverrides: hasOverrides, | ||
| HasFileOverrides: hasFileOverrides, | ||
| HasPackageOverrides: hasPackageOverrides, | ||
| FilesBelowThreshold: checkCoverageStatsBelowThreshold(current, thr.File, overrideRules), | ||
| PackagesBelowThreshold: checkCoverageStatsBelowThreshold( | ||
| makePackageStats(current), thr.Package, overrideRules, | ||
|
|
@@ -90,6 +96,21 @@ | |
| } | ||
| } | ||
|
|
||
| func detectOverrides(overrides []Override) (hasFileOverrides, hasPackageOverrides bool) { | ||
| for _, override := range overrides { | ||
| if strings.HasSuffix(override.Path, ".go") { | ||
| hasFileOverrides = true | ||
| } | ||
| if strings.HasPrefix(override.Path, "^") { | ||
| hasPackageOverrides = true | ||
| } | ||
|
||
| if hasFileOverrides && hasPackageOverrides { | ||
|
||
| return // Early return if both found | ||
| } | ||
| } | ||
| return | ||
| } | ||
|
|
||
| func saveCoverageBreakdown(cfg Config, stats []coverage.Stats) error { | ||
| if cfg.BreakdownFileName == "" { | ||
| return nil | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if len(cfg.Override) > 0 {seems unnecessary,detectOverridesshould return correct result for any size ofcfg.Override