Romanx / Cake.Coverlet

Coverlet extensions for Cake Build
MIT License
40 stars 15 forks source link

Add Exclude By Attribute support to command line #19

Closed glennawatson closed 5 years ago

glennawatson commented 5 years ago

At the moment there is no support for exclude by attribute which coverlet does support.

Added that support.

Fixes #20

Romanx commented 5 years ago

Thanks very much for the feature request and the implementation. I've opened an issue #20 to track this.

It looks like the result format for the global tool line isn't quite right since the exclude by attribute format should be like --exclude-by-attribute "Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute" and yours is --exclude-by-attribute "Obsolete" --exclude-by-attribute "GeneratedCodeAttribute" at least looking at the tests.

I'm assuming both are work but could you confirm this is the case?

glennawatson commented 5 years ago

@Romanx Will check it out tomorrow for you.

glennawatson commented 5 years ago
--target "dotnet" --targetargs "test C:/source/splat/src/Splat.Tests/Splat.Tests.csproj --configuration Release --no-build" --format opencover --output "C:/source/splat/artifacts/tests/opencover.xml" --exclude-by-file "*/*Designer.cs" --exclude-by-file "*/*.g.cs" --exclude-by-file "*/*.g.i.cs" --exclude-by-file "*splat/splat*" --exclude-by-file "*ApprovalTests*" --exclude "+[*]*" --exclude "-[*.Testing]*" --exclude "-[*.Tests*]*" --exclude "-[ReactiveUI.Events]*" --exclude "-[Splat*]*" --exclude-by-attribute "*.ExcludeFromCodeCoverage*" --exclude-by-attribute "*Fact*"

The above worked fine with the two parameters passed in.

Sorry for the delay @Romanx

glennawatson commented 5 years ago

In Coverlet.Console.Program, the command options are also declared the same way which confirms it

   CommandOption excludeFilters = app.Option("--exclude", "Filter expressions to exclude specific modules and types.", CommandOptionType.MultipleValue);
   CommandOption excludeAttributes = app.Option("--exclude-by-attribute", "Attributes to exclude from code coverage.", CommandOptionType.MultipleValue);

So looks like either comma separated or multiple tags works fine.

Romanx commented 5 years ago

Thanks for the contribution @glennawatson, i'll merge this and get it released later today.