Skip to content
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

_test.go files are now shown in coverage list #62

Open
Cosby86 opened this issue Feb 12, 2018 · 7 comments
Open

_test.go files are now shown in coverage list #62

Cosby86 opened this issue Feb 12, 2018 · 7 comments

Comments

@Cosby86
Copy link

Cosby86 commented Feb 12, 2018

Hello all
i just updated my sonar plugin to the latest RC (rc12). Despite I added those 2 lines into config file

sonar.test.inclusions=/_test.go
sonar.sources.inclusions=/.go

In my coverage file list now are shown _test,go files too

@thibaultfalque
Copy link
Collaborator

hi @Cosby86
Could you test with this configuration ?

sonar.sources=./
sonar.tests=./
sonar.test.inclusions=**/**_test.go
sonar.sources.inclusions=**/**.go

@Cosby86
Copy link
Author

Cosby86 commented Feb 12, 2018

Thank you for the answer. Not _test files are not considered but I have in the list packages where _test.go file are not presents. In the previous version of the plugin only the coverage of those packages where _test.go file is present were listed.

@thibaultfalque
Copy link
Collaborator

Yes we have changed the coverage computation. See #56, #60 and #61. If there is not have _test.go in package the sources files of package are covered with 0%.

@Cosby86
Copy link
Author

Cosby86 commented Feb 12, 2018

It sound good. Is there any way to exclude a package from coverage mesurement?

@thibaultfalque
Copy link
Collaborator

I will ask sonarqube to know how use the sonar.coverage.exclusions property (https://docs.sonarqube.org/display/SONAR/Analysis+Parameters)

@thibaultfalque
Copy link
Collaborator

@danielleberre we can use the method doesNotMatchPathPatterns of FilePredicates for exclude the patterns of property sonar.coverage.exclusions: http://javadocs.sonarsource.org/6.2.1/apidocs/org/sonar/api/batch/fs/FilePredicates.html#doesNotMatchPathPatterns-java.lang.String:A-

@thibaultfalque
Copy link
Collaborator

Hello @Cosby86

Do you have the problem with the latest version ? If not, could you close this issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants