Skip to content

Commit

Permalink
code generator: add [ExcludeFromCodeCoverage], [Obfuscation(Exclude =…
Browse files Browse the repository at this point in the history
… true)]
  • Loading branch information
max-ieremenko committed Feb 5, 2022
1 parent 0857969 commit 578bd68
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// <copyright>
// Copyright 2021 Max Ieremenko
// Copyright 2021-2022 Max Ieremenko
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -17,7 +17,9 @@
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Threading;
Expand Down Expand Up @@ -119,6 +121,8 @@ private static IEnumerable<string> GetSharedUsing()
yield return typeof(Message).Namespace!;
yield return typeof(CompilerGeneratedAttribute).Namespace!;
yield return typeof(GeneratedCodeAttribute).Namespace!;
yield return typeof(ExcludeFromCodeCoverageAttribute).Namespace!;
yield return typeof(ObfuscationAttribute).Namespace!;
}

private static void ShowWarnings(Logger logger, ContractDescription contract, INamedTypeSymbol serviceType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ protected void WriteMetadata()
.Append("[GeneratedCode(\"ServiceModel.Grpc\", \"")
.Append(GetType().Assembly.GetName().Version.ToString(3))
.AppendLine("\")]")
.AppendLine("[CompilerGenerated]");
.AppendLine("[CompilerGenerated]")
.AppendLine("[ExcludeFromCodeCoverage]")
.AppendLine("[Obfuscation(Exclude = true)]");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyTitle>ServiceModel.Grpc.DesignTime</AssemblyTitle>
<IsRoslynComponent>true</IsRoslynComponent>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' != 'Debug'">
Expand Down

0 comments on commit 578bd68

Please sign in to comment.