-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
report when overall threshold present (or) overrides are present #141
report when overall threshold present (or) overrides are present #141
Conversation
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.
would it be possible to have two flags HasFileOverrides
and HasPackageOverrides
?
pkg/testcoverage/check.go
Outdated
|
||
return AnalyzeResult{ | ||
Threshold: thr, | ||
HasOverrides: hasOverrides, |
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.
compileOverridePathRules
does not need to return additional value, instead we can use something like this:
HasOverrides: len(overrideRules) > 0,
I have made the changes for this, please have a look |
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.
detectOverrides
seems quite good direction, please have a look at comments.
also make sure to check make lint
, make test
and make check-coverage
when you are done
pkg/testcoverage/check.go
Outdated
if len(cfg.Override) > 0 { | ||
hasFileOverrides, hasPackageOverrides = detectOverrides(cfg.Override) | ||
} |
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, detectOverrides
should return correct result for any size of cfg.Override
pkg/testcoverage/check.go
Outdated
if strings.HasSuffix(override.Path, ".go") { | ||
hasFileOverrides = true | ||
} | ||
if strings.HasPrefix(override.Path, "^") { | ||
hasPackageOverrides = true | ||
} |
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.
would it make sense to have these if statements like this:
if is file override {
...
} else {
if it is not file override then it must be package override
}
also file overrides may have .go$
suffix, for example here .
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.
I updated the check here to
if override name contains ".go" suffix || ".go$" suffix {
// file override
} else {
// pkg override
}
pkg/testcoverage/check.go
Outdated
if strings.HasPrefix(override.Path, "^") { | ||
hasPackageOverrides = true | ||
} | ||
if hasFileOverrides && hasPackageOverrides { |
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.
i don't have anything against of merging this if
, but it seems unnecessary. these overrides are usually very small, lets say there is 100 of them (99.99% of users will have less then 10). with this size, this for
cycle will finish in 1ns
or less, so this if
wont produce any noticeably benefits. and on another hand because this repo requires 100% coverage, this if
will required to have additional tests case that needs to be added or ignored.
I checked coverage stats are
|
@subhambhardwaj thanks for the effort! i'll make new release later today |
Changes:
Allow reports of pkg and file level overrides even when overall pkg and file thresholds are 0
Closes: #140