-
-
Notifications
You must be signed in to change notification settings - Fork 26
feat: configurable regexp for coverage-ignore #212
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
base: main
Are you sure you want to change the base?
feat: configurable regexp for coverage-ignore #212
Conversation
…comment must follow any // coverage-ignore.
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.
-
feature should be tested with unit tests on all levels
- `pkg/testcoverage/config_test.go``
TestConfigYamlParse
pkg/testcoverage/coverage/cover_test.go
- new test that will check this functionality with different values used (similar to test
Test_findAnnotations
but in this test second argument ofFindAnnotations
must be used with different values)
- new test that will check this functionality with different values used (similar to test
pkg/testcoverage/check_test.go
- a case in
func TestCheck(t *testing.T)
where non default value ofIgnoreTextRegex
is used
- a case in
- `pkg/testcoverage/config_test.go``
-
IgnoreTextRegex
does not seem suitable name why notCoverageIgnoreRegex
?
# (optional; default '//coverage-ignore') | ||
# ignore-text-regex: Defines regular expressions to match specific comment patterns in your code | ||
# that will be recognized as valid coverage ignore markers. | ||
# | ||
# this feature can be used to ensure team members properly document WHY coverage is being skipped, | ||
# which helps maintain code quality and avoid unexplained coverage gaps. | ||
ignore-text-regex: |
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.
# (optional; default '//coverage-ignore') | |
# ignore-text-regex: Defines regular expressions to match specific comment patterns in your code | |
# that will be recognized as valid coverage ignore markers. | |
# | |
# this feature can be used to ensure team members properly document WHY coverage is being skipped, | |
# which helps maintain code quality and avoid unexplained coverage gaps. | |
ignore-text-regex: | |
# (optional) | |
# Defines regular expressions to match specific comment patterns in your code | |
# that will be recognized as valid coverage ignore markers. | |
# By default lines having `//coverage-ignore` are excluded from coverage statistic. | |
ignore-text-regex: '' |
@@ -83,6 +83,7 @@ func TestCheck(t *testing.T) { | |||
Paths: []string{`cdn\.go$`, `github\.go$`, `cover\.go$`, `check\.go$`, `path\.go$`}, | |||
}, | |||
SourceDir: sourceDir, | |||
IgnoreTextRegex: "", |
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.
why specify value us empty string (default)?
@@ -44,6 +44,7 @@ func Test_GenerateCoverageStats(t *testing.T) { | |||
stats, err = GenerateCoverageStats(Config{ | |||
Profiles: []string{profileNOK}, | |||
SourceDir: sourceDir, | |||
IgnoreTextRegex: "", |
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.
why specify value us empty string (default)? here and other places in same file.
…with-coverage-ignore
Enforce Explanatory Comments with // coverage-ignore. When a user adds a // coverage-ignore annotation, the tool should enforce that an additional explanatory comment is provided.