allow excluding entire types from coverage tracking

This commit is contained in:
Oluwatoni Solarin-Sodara
2018-03-19 12:16:18 +01:00
parent 1670354e58
commit c191876b54
@@ -55,9 +55,12 @@ namespace Coverlet.Core.Instrumentation
foreach (var type in module.GetTypes())
{
if (type.CustomAttributes.Any(a => a.AttributeType.Name == "ExcludeFromCoverageAttribute" || a.AttributeType.Name == "ExcludeFromCoverage"))
continue;
foreach (var method in type.Methods)
{
if (!method.CustomAttributes.Any(a => a.AttributeType.Name == "ExcludeFromCoverageAttribute"))
if (!method.CustomAttributes.Any(a => a.AttributeType.Name == "ExcludeFromCoverageAttribute" || a.AttributeType.Name == "ExcludeFromCoverage"))
InstrumentMethod(method);
}
}