Made list of attribute names local variable

This commit is contained in:
Zeid Derhally
2018-06-05 14:38:09 -04:00
parent 15dfa17f80
commit c1916a9a91
@@ -24,14 +24,6 @@ namespace Coverlet.Core.Instrumentation
private readonly static Lazy<MethodInfo> _markExecutedMethodLoader = new Lazy<MethodInfo>(GetMarkExecutedMethod);
private InstrumenterResult _result;
private static readonly string[] _excludeAttributeNames = new[]
{
nameof(ExcludeFromCoverageAttribute),
"ExcludeFromCoverage",
nameof(ExcludeFromCodeCoverageAttribute),
"ExcludeFromCodeCoverage"
};
public Instrumenter(string module, string identifier, string[] filters, string[] excludedFiles)
{
_module = module;
@@ -278,8 +270,16 @@ namespace Coverlet.Core.Instrumentation
private static bool IsExcludeAttribute(CustomAttribute customAttribute)
{
var excludeAttributeNames = new[]
{
nameof(ExcludeFromCoverageAttribute),
"ExcludeFromCoverage",
nameof(ExcludeFromCodeCoverageAttribute),
"ExcludeFromCodeCoverage"
};
var attributeName = customAttribute.AttributeType.Name;
return _excludeAttributeNames.Any(a => a.Equals(attributeName));
return excludeAttributeNames.Any(a => a.Equals(attributeName));
}
private static Mono.Cecil.Cil.MethodBody GetMethodBody(MethodDefinition method)