-
-
Notifications
You must be signed in to change notification settings - Fork 274
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
[Feature request] Filtering the whole directory #366
Comments
Have you tried |
@danielpalme I tried that, and seem like it doesn't work. |
Please have a look at the generated report. You have to identify the namespaces you want to exclude. |
It seems for clover, the value in If you look at a <coverage>
<project name="my-project 1.0" timestamp="1596157313247">
...
</project>
<testproject name="my-project 1.0" timestamp="1596157313247">
...
<testproject>
</coverage> ReportGenerator treats both identically: var projectElement = new XElement(
"project",
new XAttribute("timestamp", timeStamp));
rootElement.Add(projectElement);
var testProjectElement = new XElement(
"testproject",
new XAttribute("timestamp", timeStamp));
rootElement.Add(testProjectElement); Wouldn't clover users in general be happy if you just ignored the |
I don't think so. Coverlet did the same and now test assemblies are included in the results. Some users want that as well. |
The test code being part of the report listing all files does not bother me, but the 100% test code coverage skewing a e.g. 50% production code coverage towards 70% or so does. And I'd be surprised if any user wants the coverage % figure to include coverage from test code. Be that as it may - could we perhaps get a flag to control that, in case you do not want to change the default? |
Release 4.6.3 of ReportGenerator (should be available within a few minutes) add a new flag to control that behavior. Add |
Thanks! I'm using this from AzDO. Your version 4.6.3 has been automatically updated, and I tried this, as well as the camel-caps version - task: reportgenerator@4
displayName: 'convert clover report -> cobertura'
inputs:
reports: '$(Build.SourcesDirectory)/target/site/clover/clover.xml'
excludetestprojects: true
targetdir: '$(Build.SourcesDirectory)/CoverageResults' However, the parameter does not seem to get recognized - and tests in fact did not get excluded:
A quick grep for "filefilters" vs "excludetest" shows the latter is not present in the following files that contain the former. Perhaps one of them needs to be changed to support the new flag.
But hey, code coverage surged from 66% (using filefilters) to a respectable 83% - so maybe we should just keep it this way ;-) |
You are right, i'll have to update the Azure DevOps extension to support those settings. |
The following should work with version 4.6.4: - task: reportgenerator@4
displayName: 'convert clover report -> cobertura'
inputs:
reports: '$(Build.SourcesDirectory)/target/site/clover/clover.xml'
targetdir: '$(Build.SourcesDirectory)/CoverageResults'
customSettings: 'settings:excludeTestProjects=true' |
This works! Thanks a lot! |
"-filefilters -*Test.java" kind of works but that would be more useful if there is an option to generate the report for everything under src/main only without including anything under src/test.
e.g. If we have utility classes under src/test that doesn't have the name *Test.java or if we have a class in src/main that is *Test.java
Thanks
The text was updated successfully, but these errors were encountered: