Skip to content

Commit

Permalink
Merge pull request #63 from wforney/main
Browse files Browse the repository at this point in the history
feat: Add ExcludeFromCodeCoverage attribute to embedded resources
  • Loading branch information
Sergio0694 authored May 15, 2023
2 parents 6e69340 + d3b71ed commit 6d3c322
Show file tree
Hide file tree
Showing 43 changed files with 73 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace System.Diagnostics.CodeAnalysis
global::System.AttributeTargets.Field |
global::System.AttributeTargets.Method,
AllowMultiple = true, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")]
internal sealed class DynamicDependencyAttribute : global::System.Attribute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ namespace System.Diagnostics.CodeAnalysis
global::System.AttributeTargets.Interface |
global::System.AttributeTargets.Struct,
Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")]
internal sealed class DynamicallyAccessedMembersAttribute : global::System.Attribute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace System.Diagnostics.CodeAnalysis
global::System.AttributeTargets.Constructor |
global::System.AttributeTargets.Class,
Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")]
internal sealed class RequiresDynamicCodeAttribute : global::System.Attribute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace System.Diagnostics.CodeAnalysis
global::System.AttributeTargets.Method |
global::System.AttributeTargets.Constructor |
global::System.AttributeTargets.Class, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")]
internal sealed class RequiresUnreferencedCodeAttribute : global::System.Attribute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace System.Diagnostics.CodeAnalysis
/// <see cref="global::System.Diagnostics.ConditionalAttribute"/>. So it is always preserved in the compiled assembly.
/// </remarks>
[global::System.AttributeUsage(global::System.AttributeTargets.All, Inherited = false, AllowMultiple = true)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")]
internal sealed class UnconditionalSuppressMessageAttribute : global::System.Attribute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace System.Diagnostics
global::System.AttributeTargets.Constructor |
global::System.AttributeTargets.Struct,
Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")]
internal sealed class StackTraceHiddenAttribute : global::System.Attribute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace System.Runtime.CompilerServices
/// - LCIDConversionAttribute support is disabled.
/// </remarks>
[global::System.AttributeUsage(global::System.AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")]
internal sealed class DisableRuntimeMarshallingAttribute : global::System.Attribute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ namespace System.Runtime.InteropServices
/// * Data corruption.
/// </remarks>
[global::System.AttributeUsage(global::System.AttributeTargets.Method, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")]
internal sealed class SuppressGCTransitionAttribute : global::System.Attribute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace System.Runtime.InteropServices
/// * Must only have <see href="https://docs.microsoft.com/dotnet/framework/interop/blittable-and-non-blittable-types">blittable</see> arguments.
/// </remarks>
[global::System.AttributeUsage(global::System.AttributeTargets.Method, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")]
internal sealed class UnmanagedCallersOnlyAttribute : global::System.Attribute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ namespace System.Runtime.Versioning
global::System.AttributeTargets.Property |
global::System.AttributeTargets.Struct,
AllowMultiple = true, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")]
internal sealed class ObsoletedOSPlatformAttribute : global::System.Attribute // OSPlatformAttribute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace System.Runtime.Versioning
global::System.AttributeTargets.Property |
global::System.AttributeTargets.Struct,
AllowMultiple = true, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")]
internal sealed class SupportedOSPlatformAttribute : global::System.Attribute // OSPlatformAttribute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace System.Runtime.Versioning
global::System.AttributeTargets.Method |
global::System.AttributeTargets.Property,
AllowMultiple = true, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")]
internal sealed class SupportedOSPlatformGuardAttribute : global::System.Attribute // OSPlatformAttribute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace System.Runtime.Versioning
/// Records the platform that the project targeted.
/// </summary>
[global::System.AttributeUsage(global::System.AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")]
internal sealed class TargetPlatformAttribute : global::System.Attribute // OSPlatformAttribute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace System.Runtime.Versioning
global::System.AttributeTargets.Property |
global::System.AttributeTargets.Struct,
AllowMultiple = true, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")]
internal sealed class UnsupportedOSPlatformAttribute : global::System.Attribute // OSPlatformAttribute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace System.Runtime.Versioning
global::System.AttributeTargets.Method |
global::System.AttributeTargets.Property,
AllowMultiple = true, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")]
internal sealed class UnsupportedOSPlatformGuardAttribute : global::System.Attribute // OSPlatformAttribute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace System.Diagnostics.CodeAnalysis
global::System.AttributeTargets.Parameter |
global::System.AttributeTargets.Property,
Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class AllowNullAttribute : global::System.Attribute
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace System.Diagnostics.CodeAnalysis
global::System.AttributeTargets.Parameter |
global::System.AttributeTargets.Property,
Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class DisallowNullAttribute : global::System.Attribute
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace System.Diagnostics.CodeAnalysis
/// Applied to a method that will never return under any circumstance.
/// </summary>
[global::System.AttributeUsage(global::System.AttributeTargets.Method, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class DoesNotReturnAttribute : global::System.Attribute
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace System.Diagnostics.CodeAnalysis
/// Specifies that the method will not return if the associated Boolean parameter is passed the specified value.
/// </summary>
[global::System.AttributeUsage(global::System.AttributeTargets.Parameter, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class DoesNotReturnIfAttribute : global::System.Attribute
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace System.Diagnostics.CodeAnalysis
global::System.AttributeTargets.Property |
global::System.AttributeTargets.ReturnValue,
Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class MaybeNullAttribute : global::System.Attribute
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace System.Diagnostics.CodeAnalysis
/// Specifies that when a method returns <see cref="ReturnValue"/>, the parameter may be null even if the corresponding type disallows it.
/// </summary>
[global::System.AttributeUsage(global::System.AttributeTargets.Parameter, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class MaybeNullWhenAttribute : global::System.Attribute
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace System.Diagnostics.CodeAnalysis
global::System.AttributeTargets.Method |
global::System.AttributeTargets.Property,
Inherited = false, AllowMultiple = true)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class MemberNotNullAttribute : global::System.Attribute
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace System.Diagnostics.CodeAnalysis
global::System.AttributeTargets.Method |
global::System.AttributeTargets.Property,
Inherited = false, AllowMultiple = true)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class MemberNotNullWhenAttribute : global::System.Attribute
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace System.Diagnostics.CodeAnalysis
global::System.AttributeTargets.Property |
global::System.AttributeTargets.ReturnValue,
Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class NotNullAttribute : global::System.Attribute
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace System.Diagnostics.CodeAnalysis
global::System.AttributeTargets.Property |
global::System.AttributeTargets.ReturnValue,
AllowMultiple = true, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class NotNullIfNotNullAttribute : global::System.Attribute
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace System.Diagnostics.CodeAnalysis
/// Specifies that when a method returns <see cref="ReturnValue"/>, the parameter will not be null even if the corresponding type allows it.
/// </summary>
[global::System.AttributeUsage(global::System.AttributeTargets.Parameter, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class NotNullWhenAttribute : global::System.Attribute
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace System.Diagnostics.CodeAnalysis
/// and callers do not need to set any required members themselves.
/// </summary>
[global::System.AttributeUsage(global::System.AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class SetsRequiredMembersAttribute : global::System.Attribute
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace System.Diagnostics.CodeAnalysis
global::System.AttributeTargets.Field |
global::System.AttributeTargets.Property,
AllowMultiple = false, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class StringSyntaxAttribute : global::System.Attribute
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace System.Diagnostics.CodeAnalysis
global::System.AttributeTargets.Parameter,
AllowMultiple = false,
Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class UnscopedRefAttribute : global::System.Attribute
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace System
/// int lastElement = someArray[^1]; // lastElement = 5
/// </code>
/// </remarks>
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal readonly struct Index : global::System.IEquatable<global::System.Index>
{
private readonly int _value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace System
/// int[] subArray2 = someArray[1..^0]; // { 2, 3, 4, 5 }
/// </code>
/// </remarks>
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal readonly struct Range : global::System.IEquatable<global::System.Range>
{
/// <summary>Represent the inclusive start index of the Range.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace System.Runtime.CompilerServices
global::System.AttributeTargets.Enum |
global::System.AttributeTargets.Method,
Inherited = false, AllowMultiple = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class AsyncMethodBuilderAttribute : global::System.Attribute
{
/// <summary>Initializes the <see cref="global::System.Runtime.CompilerServices.AsyncMethodBuilderAttribute"/>.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace System.Runtime.CompilerServices
/// An attribute that allows parameters to receive the expression of other parameters.
/// </summary>
[global::System.AttributeUsage(global::System.AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class CallerArgumentExpressionAttribute : global::System.Attribute
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace System.Runtime.CompilerServices
/// Indicates that compiler support for a particular feature is required for the location where this attribute is applied.
/// </summary>
[global::System.AttributeUsage(global::System.AttributeTargets.All, AllowMultiple = true, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class CompilerFeatureRequiredAttribute : global::System.Attribute
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace System.Runtime.CompilerServices
/// Indicates which arguments to a method involving an interpolated string handler should be passed to that handler.
/// </summary>
[global::System.AttributeUsage(global::System.AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class InterpolatedStringHandlerArgumentAttribute : global::System.Attribute
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace System.Runtime.CompilerServices
global::System.AttributeTargets.Class |
global::System.AttributeTargets.Struct,
AllowMultiple = false, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class InterpolatedStringHandlerAttribute : global::System.Attribute
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace System.Runtime.CompilerServices
/// This class should not be used by developers in source code.
/// </summary>
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static class IsExternalInit
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ namespace System.Runtime.CompilerServices
/// https://github.com/dotnet/runtime/blob/main/docs/design/specs/Ecma-335-Augments.md#module-initializer
/// </remarks>
[global::System.AttributeUsage(global::System.AttributeTargets.Method, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class ModuleInitializerAttribute : global::System.Attribute
{
public ModuleInitializerAttribute()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace System.Runtime.CompilerServices
global::System.AttributeTargets.Property,
AllowMultiple = false,
Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class RequiredMemberAttribute : global::System.Attribute
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace System.Runtime.CompilerServices
global::System.AttributeTargets.Property |
global::System.AttributeTargets.Event,
Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class SkipLocalsInitAttribute : global::System.Attribute
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace System.Runtime.Versioning
global::System.AttributeTargets.Property |
global::System.AttributeTargets.Field |
AttributeTargets.Event, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class RequiresPreviewFeaturesAttribute : global::System.Attribute
{
/// <summary>
Expand Down
7 changes: 6 additions & 1 deletion src/PolySharp.SourceGenerators/Models/SyntaxFixupType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@ internal enum SyntaxFixupType
/// </summary>
RemoveMethodImplAttributes = 1 << 0,

/// <summary>
/// Remove all <c>[ExcludeFromCodeCoverage]</c> attributes.
/// </summary>
RemoveExcludeFromCodeCoverageAttributes = 1 << 1,

/// <summary>
/// Generates the <c>[UnmanagedCallersOnly]</c> type in the <c>InteropServices2</c> dummy namespace.
/// </summary>
/// <remarks>This is needed when methods annotated with the attribute have to be assigned to delegates, which Roslyn will otherwise block.</remarks>
UseInteropServices2ForUnmanagedCallersOnlyAttribute = 1 << 1
UseInteropServices2ForUnmanagedCallersOnlyAttribute = 1 << 2
}
Loading

0 comments on commit 6d3c322

Please sign in to comment.