From c1916a9a915dfac7a3dfa4bb23a79044d87716bf Mon Sep 17 00:00:00 2001 From: Zeid Derhally Date: Tue, 5 Jun 2018 14:38:09 -0400 Subject: [PATCH] Made list of attribute names local variable --- .../Instrumentation/Instrumenter.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/coverlet.core/Instrumentation/Instrumenter.cs b/src/coverlet.core/Instrumentation/Instrumenter.cs index 9d71473..c94a92d 100644 --- a/src/coverlet.core/Instrumentation/Instrumenter.cs +++ b/src/coverlet.core/Instrumentation/Instrumenter.cs @@ -24,14 +24,6 @@ namespace Coverlet.Core.Instrumentation private readonly static Lazy _markExecutedMethodLoader = new Lazy(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)