From 720169de090a484151a0a60aecb8f02fc522e096 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Tue, 18 Jun 2024 17:41:44 +1000 Subject: [PATCH] Add missing code decorations (#188) --- src/Directory.Build.props | 2 +- src/Polyfill/Nullable/NotNullIfNotNullAttribute.cs | 1 + src/Polyfill/Nullable/NotNullWhenAttribute.cs | 1 + src/Polyfill/Numbers/BytePolyfill.cs | 1 + src/Polyfill/Numbers/DoublePolyfill.cs | 1 + src/Polyfill/Numbers/IntPolyfill.cs | 1 + src/Polyfill/Numbers/LongPolyfill.cs | 1 + src/Polyfill/Numbers/SBytePolyfill.cs | 1 + src/Polyfill/Numbers/ShortPolyfill.cs | 1 + src/Polyfill/Numbers/UIntPolyfill.cs | 1 + src/Polyfill/Numbers/ULongPolyfill.cs | 1 + src/Polyfill/Numbers/UShortPolyfill.cs | 1 + .../InterpolatedStringHandlerArgumentAttribute.cs | 1 + .../InterpolatedStringHandlerAttribute.cs | 1 + .../Trimming/DynamicallyAccessedMembersAttribute.cs | 1 + src/Tests/SanityChecks.cs | 8 +++++++- 16 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 69ed2096..e826578c 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,7 +1,7 @@ - 5.5.0 + 5.5.1 1.0.0 Polyfill true diff --git a/src/Polyfill/Nullable/NotNullIfNotNullAttribute.cs b/src/Polyfill/Nullable/NotNullIfNotNullAttribute.cs index 621fb50d..50afab43 100644 --- a/src/Polyfill/Nullable/NotNullIfNotNullAttribute.cs +++ b/src/Polyfill/Nullable/NotNullIfNotNullAttribute.cs @@ -1,4 +1,5 @@ // +#pragma warning disable #if NETSTANDARD2_0 || NETFRAMEWORK || NETCOREAPP2X diff --git a/src/Polyfill/Nullable/NotNullWhenAttribute.cs b/src/Polyfill/Nullable/NotNullWhenAttribute.cs index 6136e494..be043ad9 100644 --- a/src/Polyfill/Nullable/NotNullWhenAttribute.cs +++ b/src/Polyfill/Nullable/NotNullWhenAttribute.cs @@ -1,4 +1,5 @@ // +#pragma warning disable #if NETSTANDARD2_0 || NETFRAMEWORK || NETCOREAPP2X diff --git a/src/Polyfill/Numbers/BytePolyfill.cs b/src/Polyfill/Numbers/BytePolyfill.cs index 630f623c..464ecb22 100644 --- a/src/Polyfill/Numbers/BytePolyfill.cs +++ b/src/Polyfill/Numbers/BytePolyfill.cs @@ -1,3 +1,4 @@ +// #pragma warning disable // ReSharper disable RedundantUsingDirective diff --git a/src/Polyfill/Numbers/DoublePolyfill.cs b/src/Polyfill/Numbers/DoublePolyfill.cs index 07d92f0b..7efab81c 100644 --- a/src/Polyfill/Numbers/DoublePolyfill.cs +++ b/src/Polyfill/Numbers/DoublePolyfill.cs @@ -1,3 +1,4 @@ +// #pragma warning disable // ReSharper disable RedundantUsingDirective diff --git a/src/Polyfill/Numbers/IntPolyfill.cs b/src/Polyfill/Numbers/IntPolyfill.cs index 437dfff3..a5da2863 100644 --- a/src/Polyfill/Numbers/IntPolyfill.cs +++ b/src/Polyfill/Numbers/IntPolyfill.cs @@ -1,3 +1,4 @@ +// #pragma warning disable // ReSharper disable RedundantUsingDirective diff --git a/src/Polyfill/Numbers/LongPolyfill.cs b/src/Polyfill/Numbers/LongPolyfill.cs index 1e46825f..0884cdcc 100644 --- a/src/Polyfill/Numbers/LongPolyfill.cs +++ b/src/Polyfill/Numbers/LongPolyfill.cs @@ -1,3 +1,4 @@ +// #pragma warning disable // ReSharper disable RedundantUsingDirective diff --git a/src/Polyfill/Numbers/SBytePolyfill.cs b/src/Polyfill/Numbers/SBytePolyfill.cs index e9858cc2..9ba78155 100644 --- a/src/Polyfill/Numbers/SBytePolyfill.cs +++ b/src/Polyfill/Numbers/SBytePolyfill.cs @@ -1,3 +1,4 @@ +// #pragma warning disable // ReSharper disable RedundantUsingDirective diff --git a/src/Polyfill/Numbers/ShortPolyfill.cs b/src/Polyfill/Numbers/ShortPolyfill.cs index 0ebc961f..1613f055 100644 --- a/src/Polyfill/Numbers/ShortPolyfill.cs +++ b/src/Polyfill/Numbers/ShortPolyfill.cs @@ -1,3 +1,4 @@ +// #pragma warning disable // ReSharper disable RedundantUsingDirective diff --git a/src/Polyfill/Numbers/UIntPolyfill.cs b/src/Polyfill/Numbers/UIntPolyfill.cs index 9c9b14e3..9e0c7110 100644 --- a/src/Polyfill/Numbers/UIntPolyfill.cs +++ b/src/Polyfill/Numbers/UIntPolyfill.cs @@ -1,3 +1,4 @@ +// #pragma warning disable // ReSharper disable RedundantUsingDirective diff --git a/src/Polyfill/Numbers/ULongPolyfill.cs b/src/Polyfill/Numbers/ULongPolyfill.cs index 3fb9cae2..3ae3f320 100644 --- a/src/Polyfill/Numbers/ULongPolyfill.cs +++ b/src/Polyfill/Numbers/ULongPolyfill.cs @@ -1,3 +1,4 @@ +// #pragma warning disable // ReSharper disable RedundantUsingDirective diff --git a/src/Polyfill/Numbers/UShortPolyfill.cs b/src/Polyfill/Numbers/UShortPolyfill.cs index 6fbe6d0c..56926a30 100644 --- a/src/Polyfill/Numbers/UShortPolyfill.cs +++ b/src/Polyfill/Numbers/UShortPolyfill.cs @@ -1,3 +1,4 @@ +// #pragma warning disable // ReSharper disable RedundantUsingDirective diff --git a/src/Polyfill/StringInterpolation/InterpolatedStringHandlerArgumentAttribute.cs b/src/Polyfill/StringInterpolation/InterpolatedStringHandlerArgumentAttribute.cs index 04ee127e..e5737b06 100644 --- a/src/Polyfill/StringInterpolation/InterpolatedStringHandlerArgumentAttribute.cs +++ b/src/Polyfill/StringInterpolation/InterpolatedStringHandlerArgumentAttribute.cs @@ -1,4 +1,5 @@ // +#pragma warning disable #if !NET6_0_OR_GREATER diff --git a/src/Polyfill/StringInterpolation/InterpolatedStringHandlerAttribute.cs b/src/Polyfill/StringInterpolation/InterpolatedStringHandlerAttribute.cs index 387c00ed..1be3fc2f 100644 --- a/src/Polyfill/StringInterpolation/InterpolatedStringHandlerAttribute.cs +++ b/src/Polyfill/StringInterpolation/InterpolatedStringHandlerAttribute.cs @@ -1,4 +1,5 @@ // +#pragma warning disable #if !NET6_0_OR_GREATER diff --git a/src/Polyfill/Trimming/DynamicallyAccessedMembersAttribute.cs b/src/Polyfill/Trimming/DynamicallyAccessedMembersAttribute.cs index 610449ec..1cda5670 100644 --- a/src/Polyfill/Trimming/DynamicallyAccessedMembersAttribute.cs +++ b/src/Polyfill/Trimming/DynamicallyAccessedMembersAttribute.cs @@ -1,4 +1,5 @@ // +#pragma warning disable #if !NET5_0_OR_GREATER diff --git a/src/Tests/SanityChecks.cs b/src/Tests/SanityChecks.cs index 54cf0dc5..b9f6e77a 100644 --- a/src/Tests/SanityChecks.cs +++ b/src/Tests/SanityChecks.cs @@ -23,8 +23,14 @@ public void CodeChecks() { var dir = Path.Combine(SolutionDirectoryFinder.Find(), "Polyfill"); var errors = new List(); - foreach (var file in Directory.EnumerateFiles(dir, "*.cs")) + foreach (var file in Directory.EnumerateFiles(dir, "*.cs", SearchOption.AllDirectories)) { + var directoryName = Path.GetDirectoryName(file)!; + if (directoryName.Contains("bin") || directoryName.Contains("obj")) + { + continue; + } + var content = File.ReadAllText(file); var requiredText = new[] {