Skip to content

Commit c1916a9

Browse files
committed
Made list of attribute names local variable
1 parent 15dfa17 commit c1916a9

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/coverlet.core/Instrumentation/Instrumenter.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,6 @@ internal class Instrumenter
2424
private readonly static Lazy<MethodInfo> _markExecutedMethodLoader = new Lazy<MethodInfo>(GetMarkExecutedMethod);
2525
private InstrumenterResult _result;
2626

27-
private static readonly string[] _excludeAttributeNames = new[]
28-
{
29-
nameof(ExcludeFromCoverageAttribute),
30-
"ExcludeFromCoverage",
31-
nameof(ExcludeFromCodeCoverageAttribute),
32-
"ExcludeFromCodeCoverage"
33-
};
34-
3527
public Instrumenter(string module, string identifier, string[] filters, string[] excludedFiles)
3628
{
3729
_module = module;
@@ -278,8 +270,16 @@ private static void ReplaceExceptionHandlerBoundary(ExceptionHandler handler, In
278270

279271
private static bool IsExcludeAttribute(CustomAttribute customAttribute)
280272
{
273+
var excludeAttributeNames = new[]
274+
{
275+
nameof(ExcludeFromCoverageAttribute),
276+
"ExcludeFromCoverage",
277+
nameof(ExcludeFromCodeCoverageAttribute),
278+
"ExcludeFromCodeCoverage"
279+
};
280+
281281
var attributeName = customAttribute.AttributeType.Name;
282-
return _excludeAttributeNames.Any(a => a.Equals(attributeName));
282+
return excludeAttributeNames.Any(a => a.Equals(attributeName));
283283
}
284284

285285
private static Mono.Cecil.Cil.MethodBody GetMethodBody(MethodDefinition method)

0 commit comments

Comments
 (0)