diff --git a/bench/.editorconfig b/bench/.editorconfig index b461a73f3ba..0d495f075f7 100644 --- a/bench/.editorconfig +++ b/bench/.editorconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:52Z +# Generated : 2023-08-07 17:59:53Z # Max Tier : 2147483647 # Attributes: general, performance -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers [*.cs] @@ -104,6 +104,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = warning +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = warning + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -473,6 +478,11 @@ dotnet_diagnostic.CA1507.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 dotnet_diagnostic.CA1508.severity = warning +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Invalid entry in code metrics rule specification file # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509 @@ -790,7 +800,7 @@ dotnet_diagnostic.CA1847.severity = warning # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use R9 logging model instead +# Comment : Use the code generated model instead. dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -811,7 +821,6 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -# Redundant: R9A013 dotnet_diagnostic.CA1852.severity = none # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' @@ -842,23 +851,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = warning # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = warning # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = warning + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = warning + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = warning + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = warning + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1174,6 +1218,11 @@ dotnet_diagnostic.CA2259.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = warning +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1669,6 +1718,66 @@ dotnet_diagnostic.CA5404.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = none +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = warning + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = warning + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = none + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = warning + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = warning + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = warning + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = warning + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = warning + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = warning + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = none + # Title : Set MSBuild property 'GenerateDocumentationFile' to 'true' # Category : Style # Help Link: https://github.com/dotnet/roslyn/issues/41640 @@ -1967,7 +2076,7 @@ dotnet_diagnostic.IDE0051.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0052 dotnet_diagnostic.IDE0052.severity = warning -# Title : Use block body for lambda expression +# Title : Use expression body for lambda expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0053 # Comment : This metadata was entered manually, since it is not exposed in the normal way from the analyzer assembly. @@ -2105,7 +2214,7 @@ dotnet_style_prefer_simplified_interpolation = true # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0072 dotnet_diagnostic.IDE0072.severity = silent -# Title : The file header does not match the required text +# Title : The file header is missing or not located at the top of the file # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0073 dotnet_diagnostic.IDE0073.severity = warning @@ -2284,6 +2393,21 @@ dotnet_diagnostic.IDE0270.severity = silent # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0280 dotnet_diagnostic.IDE0280.severity = silent +# Title : Use primary constructor +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0290 +dotnet_diagnostic.IDE0290.severity = none + +# Title : Simplify collection initialization +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0300 +dotnet_diagnostic.IDE0300.severity = none + +# Title : Simplify collection initialization +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0301 +dotnet_diagnostic.IDE0301.severity = suggestion + # Title : Delegate invocation can be simplified. # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1005 @@ -2585,7 +2709,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = warning @@ -2667,155 +2791,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = warning - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = warning +dotnet_diagnostic.LA0000.severity = warning # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = warning - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = warning - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = warning - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = warning - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = warning - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = none - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = none - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = warning - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = warning - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = warning +dotnet_diagnostic.LA0001.severity = warning # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = warning - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = warning - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = warning - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = warning - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = warning +dotnet_diagnostic.LA0002.severity = warning # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = none +dotnet_diagnostic.LA0003.severity = none # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = none +dotnet_diagnostic.LA0004.severity = none # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = none +dotnet_diagnostic.LA0005.severity = none # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = none - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = none - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = none +dotnet_diagnostic.LA0006.severity = none # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = none - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = none +dotnet_diagnostic.LA0007.severity = none # Title : # Category : Style @@ -3595,7 +3601,8 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3904,7 +3911,7 @@ dotnet_diagnostic.S3257.severity = warning # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: R9A013 +# Redundant: CA1852 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4868,7 +4875,7 @@ dotnet_diagnostic.S5773.severity = warning # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/bench/Generators/Microsoft.Gen.EnumStrings.PerformanceTests/EnumStrings.cs b/bench/Generators/Microsoft.Gen.EnumStrings.PerformanceTests/EnumStrings.cs index 6ce2a3967c6..33d985958d6 100644 --- a/bench/Generators/Microsoft.Gen.EnumStrings.PerformanceTests/EnumStrings.cs +++ b/bench/Generators/Microsoft.Gen.EnumStrings.PerformanceTests/EnumStrings.cs @@ -8,7 +8,7 @@ namespace Microsoft.Gen.EnumStrings.Bench; #pragma warning disable CA1822 // Mark members as static -#pragma warning disable R9A033 // Replace uses of 'Enum.GetName' and 'Enum.ToString' with the '[EnumStrings]' code generator for improved performance +#pragma warning disable EA0006 // Replace uses of 'Enum.GetName' and 'Enum.ToString' with the '[EnumStrings]' code generator for improved performance [MemoryDiagnoser] public class EnumStrings diff --git a/bench/Libraries/Microsoft.Extensions.Http.Resilience.PerformanceTests/HedgingBenchmark.cs b/bench/Libraries/Microsoft.Extensions.Http.Resilience.PerformanceTests/HedgingBenchmark.cs index e4e23ed4a68..830e915440f 100644 --- a/bench/Libraries/Microsoft.Extensions.Http.Resilience.PerformanceTests/HedgingBenchmark.cs +++ b/bench/Libraries/Microsoft.Extensions.Http.Resilience.PerformanceTests/HedgingBenchmark.cs @@ -22,9 +22,9 @@ public void GlobalSetup() { var serviceProvider = HttpClientFactory.InitializeServiceProvider(Type); var factory = serviceProvider.GetRequiredService(); -#pragma warning disable R9A033 // Replace uses of 'Enum.GetName' and 'Enum.ToString' with the '[EnumStrings]' code generator for improved performance +#pragma warning disable EA0006 // Replace uses of 'Enum.GetName' and 'Enum.ToString' with the '[EnumStrings]' code generator for improved performance _client = factory.CreateClient(Type.ToString()); -#pragma warning restore R9A033 // Replace uses of 'Enum.GetName' and 'Enum.ToString' with the '[EnumStrings]' code generator for improved performance +#pragma warning restore EA0006 // Replace uses of 'Enum.GetName' and 'Enum.ToString' with the '[EnumStrings]' code generator for improved performance } [Params( diff --git a/bench/Libraries/Microsoft.Extensions.Http.Resilience.PerformanceTests/HttpClientFactory.cs b/bench/Libraries/Microsoft.Extensions.Http.Resilience.PerformanceTests/HttpClientFactory.cs index 09577290207..1d0452f6ccf 100644 --- a/bench/Libraries/Microsoft.Extensions.Http.Resilience.PerformanceTests/HttpClientFactory.cs +++ b/bench/Libraries/Microsoft.Extensions.Http.Resilience.PerformanceTests/HttpClientFactory.cs @@ -13,12 +13,12 @@ using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Telemetry.Metering; -#pragma warning disable R9A033 // Replace uses of 'Enum.GetName' and 'Enum.ToString' with the '[EnumStrings]' code generator for improved performance +#pragma warning disable EA0006 // Replace uses of 'Enum.GetName' and 'Enum.ToString' with the '[EnumStrings]' code generator for improved performance namespace Microsoft.Extensions.Http.Resilience.Bench; [Flags] -[SuppressMessage("Performance", "R9A031:Make types declared in an executable internal", Justification = "Needs to be public for BenchmarkDotNet consumption")] +[SuppressMessage("Performance", "EA0004:Make types declared in an executable internal", Justification = "Needs to be public for BenchmarkDotNet consumption")] public enum HedgingClientType { Weighted = 1 << 0, diff --git a/bench/Libraries/Microsoft.Extensions.Http.Resilience.PerformanceTests/HttpResilienceBenchmark.cs b/bench/Libraries/Microsoft.Extensions.Http.Resilience.PerformanceTests/HttpResilienceBenchmark.cs index c75c8cbfd16..0cba391425a 100644 --- a/bench/Libraries/Microsoft.Extensions.Http.Resilience.PerformanceTests/HttpResilienceBenchmark.cs +++ b/bench/Libraries/Microsoft.Extensions.Http.Resilience.PerformanceTests/HttpResilienceBenchmark.cs @@ -10,8 +10,6 @@ namespace Microsoft.Extensions.Http.Resilience.Bench; -#pragma warning disable R9A044 // Assign array of literal values to a static field for improved performance - public class HttpResilienceBenchmark { private static readonly Uri _uri = new(HttpClientFactory.PrimaryEndpoint); diff --git a/bench/Libraries/Microsoft.Extensions.Http.Telemetry.PerformanceTests/NoRemoteCallHandler.cs b/bench/Libraries/Microsoft.Extensions.Http.Telemetry.PerformanceTests/NoRemoteCallHandler.cs index c0c0e02b84c..95af3467cec 100644 --- a/bench/Libraries/Microsoft.Extensions.Http.Telemetry.PerformanceTests/NoRemoteCallHandler.cs +++ b/bench/Libraries/Microsoft.Extensions.Http.Telemetry.PerformanceTests/NoRemoteCallHandler.cs @@ -19,8 +19,6 @@ private NoRemoteCallHandler(byte[] data) _data = data; } - [SuppressMessage("Performance", "R9A017:Switch to an asynchronous method for increased performance.", - Justification = "No async overload for `Directory.GetFiles`.")] [SuppressMessage("Performance Analysis", "CPR120:File.ReadAllXXX should be replaced by using a StreamReader to avoid adding objects to the large object heap (LOH).", Justification = "We can live with it here")] public static NoRemoteCallHandler Create(string fileName) diff --git a/bench/Libraries/Microsoft.Extensions.Http.Telemetry.PerformanceTests/NoRemoteCallNotSeekableHandler.cs b/bench/Libraries/Microsoft.Extensions.Http.Telemetry.PerformanceTests/NoRemoteCallNotSeekableHandler.cs index 13008b3b747..611f57d68e7 100644 --- a/bench/Libraries/Microsoft.Extensions.Http.Telemetry.PerformanceTests/NoRemoteCallNotSeekableHandler.cs +++ b/bench/Libraries/Microsoft.Extensions.Http.Telemetry.PerformanceTests/NoRemoteCallNotSeekableHandler.cs @@ -19,8 +19,6 @@ private NoRemoteCallNotSeekableHandler(byte[] data) _data = data; } - [SuppressMessage("Performance", "R9A017:Switch to an asynchronous method for increased performance.", - Justification = "No async overload for `Directory.GetFiles`.")] [SuppressMessage("Performance Analysis", "CPR120:File.ReadAllXXX should be replaced by using a StreamReader to avoid adding objects to the large object heap (LOH).", Justification = "We can live with it here")] public static NoRemoteCallNotSeekableHandler Create(string fileName) diff --git a/bench/Libraries/Microsoft.Extensions.Telemetry.PerformanceTests/ExtendedLoggerBench.cs b/bench/Libraries/Microsoft.Extensions.Telemetry.PerformanceTests/ExtendedLoggerBench.cs index e2aab4ae618..5b2eaca1f33 100644 --- a/bench/Libraries/Microsoft.Extensions.Telemetry.PerformanceTests/ExtendedLoggerBench.cs +++ b/bench/Libraries/Microsoft.Extensions.Telemetry.PerformanceTests/ExtendedLoggerBench.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Diagnostics.CodeAnalysis; using BenchmarkDotNet.Attributes; using Microsoft.Extensions.Compliance.Redaction; using Microsoft.Extensions.DependencyInjection; @@ -9,8 +10,6 @@ using Microsoft.Extensions.Telemetry.Enrichment; using Microsoft.Extensions.Telemetry.Logging; -#pragma warning disable R9A000 // Switch to updated logging methods using the [LogMethod] attribute for additional performance. - namespace Microsoft.Extensions.Telemetry.Bench; [MemoryDiagnoser] @@ -80,6 +79,7 @@ private static ILogger GetLogger(LoggerFactoryVersions config) } [Benchmark] + [SuppressMessage("Performance", "EA0000:Use source generated logging methods for improved performance", Justification = "Benchmark")] public void Classic_RefTypes() { var logger = _loggers[(int)Factory]; @@ -95,6 +95,7 @@ public void Classic_RefTypes() } [Benchmark] + [SuppressMessage("Performance", "EA0000:Use source generated logging methods for improved performance", Justification = "Benchmark")] public void Classic_ValueTypes() { var logger = _loggers[(int)Factory]; diff --git a/eng/Diags/ILLink.RoslynAnalyzer.yml b/eng/Diags/ILLink.RoslynAnalyzer.yml index 755e92bb0e6..b79406b7c38 100644 --- a/eng/Diags/ILLink.RoslynAnalyzer.yml +++ b/eng/Diags/ILLink.RoslynAnalyzer.yml @@ -1,6 +1,6 @@ Origin: AssemblyName: ILLink.RoslynAnalyzer - Version: 8.0.8.26003 + Version: 8.0.8.35901 Diagnostics: IL2026: Metadata: @@ -545,7 +545,7 @@ Diagnostics: IL2096: Metadata: Category: Trimming - Title: Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. + Title: Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. Description: '' DefaultSeverity: Warning Tier: 3 diff --git a/eng/Diags/Microsoft.Analyzers.Extra.yml b/eng/Diags/Microsoft.Analyzers.Extra.yml index af1cbbd1d95..42a21498cde 100644 --- a/eng/Diags/Microsoft.Analyzers.Extra.yml +++ b/eng/Diags/Microsoft.Analyzers.Extra.yml @@ -1,52 +1,32 @@ Origin: - AssemblyName: Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0 + AssemblyName: Microsoft.Analyzers.Extra Version: 42.42.42.42424 Diagnostics: - R9A000: + EA0012: Metadata: Category: Performance - Title: Use source generated logging methods for improved performance - Description: Identifies calls to legacy logging methods - HelpLinkUri: https://TODO/r9a000 - DefaultSeverity: Warning - Tier: 1 - Attributes: - general: - Severity: None - performance: - Severity: Warning - R9A018: - Metadata: - Category: Performance - Title: Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance - Description: Identifies uses of 'String.Format' and 'StringBuilder.AppendFormat' - HelpLinkUri: https://TODO/r9a018 + Title: Consider removing unnecessary null coalescing assignment (??=) + Description: Using the null coalescing assignment operator (??=) with values which are statically known not to be null causes superfluous null checks to be performed at runtime DefaultSeverity: Warning Tier: 1 Attributes: general: - Severity: None - performance: - Severity: Warning - R9A019: + Severity: Suggestion + EA0013: Metadata: Category: Performance - Title: Remove unnecessary dictionary lookups - Description: Encourages optimal use of dictionary lookup - HelpLinkUri: https://TODO/r9a019 + Title: Consider removing unnecessary null coalescing operator (??) + Description: Using the null coalescing operator (??) with values which are statically known to be null causes superfluous null checks to be performed at runtime DefaultSeverity: Warning Tier: 1 Attributes: general: - Severity: None - performance: - Severity: Warning - R9A020: + Severity: Suggestion + EA0004: Metadata: Category: Performance - Title: Remove unnecessary set lookups - Description: Encourages optimal use of set lookup - HelpLinkUri: https://TODO/r9a020 + Title: Make types declared in an executable internal + Description: Making an executable's types internal enables dead code analysis along with other potential optimizations DefaultSeverity: Warning Tier: 1 Attributes: @@ -54,25 +34,11 @@ Diagnostics: Severity: None performance: Severity: Warning - R9A022: - Metadata: - Category: Reliability - Title: Use 'System.TimeProvider' to make the code easier to test - Description: Identifies uses of time dependent APIs that can lead to flaky tests - HelpLinkUri: https://TODO/r9a022 - DefaultSeverity: Warning - Tier: 1 - Attributes: - general: - Severity: None - production: - Severity: Warning - R9A021: + EA0001: Metadata: Category: Performance Title: Perform message formatting in the body of the logging method Description: Identifies calls to the 'ToString' method as arguments to a logging method - HelpLinkUri: https://TODO/r9a021 DefaultSeverity: Warning Tier: 1 Attributes: @@ -80,25 +46,11 @@ Diagnostics: Severity: None performance: Severity: Warning - R9A029: - Metadata: - Category: Reliability - Title: Using experimental API - Description: Indicates that code is depending on an experimental API - HelpLinkUri: https://TODO/r9a029 - DefaultSeverity: Warning - Tier: 1 - Attributes: - general: - Severity: None - general_externalonly: - Severity: Warning - R9A031: + EA0003: Metadata: Category: Performance - Title: Make types declared in an executable internal - Description: Making an executable's types internal enables dead code analysis along with other potential optimizations - HelpLinkUri: https://TODO/r9a031 + Title: Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' + Description: When checking for a single character, prefer the character overloads of 'String.StartsWith' and 'String.EndsWith' for improved performance DefaultSeverity: Warning Tier: 1 Attributes: @@ -106,25 +58,23 @@ Diagnostics: Severity: None performance: Severity: Warning - R9A030: + EA0002: Metadata: - Category: Performance - Title: Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' - Description: When checking for a single character, prefer the character overloads of 'String.StartsWith' and 'String.EndsWith' for improved performance - HelpLinkUri: https://TODO/r9a030 + Category: Reliability + Title: Use 'System.TimeProvider' to make the code easier to test + Description: Identifies uses of time dependent APIs that can lead to flaky tests DefaultSeverity: Warning Tier: 1 Attributes: general: Severity: None - performance: + production: Severity: Warning - R9A033: + EA0006: Metadata: Category: Performance Title: Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance Description: Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance - HelpLinkUri: https://TODO/r9a033 DefaultSeverity: Warning Tier: 1 Attributes: @@ -132,12 +82,11 @@ Diagnostics: Severity: None performance: Severity: Warning - R9A037: + EA0000: Metadata: Category: Performance - Title: Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance - Description: Using 'System.ValueTuple' avoids allocations and is generally more efficient than 'System.Tuple' - HelpLinkUri: https://TODO/r9a037 + Title: Use source generated logging methods for improved performance + Description: Identifies calls to legacy logging methods DefaultSeverity: Warning Tier: 1 Attributes: @@ -145,25 +94,23 @@ Diagnostics: Severity: None performance: Severity: Warning - R9A032: + EA0009: Metadata: Category: Performance - Title: Consider using an array instead of a collection - Description: Dictionaries and sets which use enums and bytes as keys can often be replaced with simple arrays for improved performance - HelpLinkUri: https://TODO/r9a032 + Title: Use 'System.MemoryExtensions.Split' for improved performance + Description: Use 'System.MemoryExtensions.Split' for improved performance DefaultSeverity: Warning Tier: 1 Attributes: general: Severity: None performance: - Severity: None - R9A040: + Severity: Warning + EA0008: Metadata: Category: Performance Title: Use generic collections instead of legacy collections for improved performance Description: Using generic collections can avoid boxing overhead and provides strong typing - HelpLinkUri: https://TODO/r9a040 DefaultSeverity: Warning Tier: 1 Attributes: @@ -171,25 +118,23 @@ Diagnostics: Severity: None performance: Severity: Warning - R9A043: + EA0005: Metadata: Category: Performance - Title: Use 'System.MemoryExtensions.Split' for improved performance - Description: Use 'System.MemoryExtensions.Split' for improved performance - HelpLinkUri: https://TODO/r9a043 + Title: Consider using an array instead of a collection + Description: Dictionaries and sets which use enums and bytes as keys can often be replaced with simple arrays for improved performance DefaultSeverity: Warning Tier: 1 Attributes: general: Severity: None performance: - Severity: Warning - R9A044: + Severity: None + EA0007: Metadata: Category: Performance - Title: Assign array of literal values to a static field for improved performance - Description: Arrays of literal values should generally be assigned to static fields in order to avoid creating them redundantly over time - HelpLinkUri: https://TODO/r9a044 + Title: Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance + Description: Using 'System.ValueTuple' avoids allocations and is generally more efficient than 'System.Tuple' DefaultSeverity: Warning Tier: 1 Attributes: @@ -197,60 +142,35 @@ Diagnostics: Severity: None performance: Severity: Warning - R9A056: + EA0010: Metadata: Category: Correctness Title: Fire-and-forget async call inside a 'using' block Description: When skipping the await keyword for asynchronous operations inside a using block, then a disposable object could be disposed before the asynchronous invocation finishes. This might result in incorrect behavior and very often ends with a runtime exception notifying that the code is trying to operate on a disposed object. - HelpLinkUri: https://TODO/r9a056 DefaultSeverity: Warning Tier: 1 Attributes: general: Severity: Warning - R9A058: - Metadata: - Category: Performance - Title: Consider removing unnecessary conditional access operator (?) - Description: Using the conditional access operator (?) to access values which are statically known not to be null causes superfluous null checks to be performed at runtime - HelpLinkUri: https://TODO/r9a058 - DefaultSeverity: Warning - Tier: 1 - Attributes: - general: - Severity: Suggestion - R9A059: + EA0014: Metadata: - Category: Performance - Title: Consider removing unnecessary null coalescing assignment (??=) - Description: Using the null coalescing assignment operator (??=) with values which are statically known not to be null causes superfluous null checks to be performed at runtime - HelpLinkUri: https://TODO/r9a059 + Category: Resilience + Title: The async method doesn't support cancellation + Description: Accepting a CancellationToken as a parameter allows caller to express a loss of interest in the result enabling the method to save cycles by finishing early DefaultSeverity: Warning Tier: 1 Attributes: general: - Severity: Suggestion - R9A060: + Severity: None + production: + Severity: Warning + EA0011: Metadata: Category: Performance - Title: Consider removing unnecessary null coalescing operator (??) - Description: Using the null coalescing operator (??) with values which are statically known to be null causes superfluous null checks to be performed at runtime - HelpLinkUri: https://TODO/r9a060 - DefaultSeverity: Warning - Tier: 1 - Attributes: - general: - Severity: Suggestion - R9A061: - Metadata: - Category: Resilience - Title: The async method doesn't support cancellation - Description: Accepting a CancellationToken as a parameter allows caller to express a loss of interest in the result enabling the method to save cycles by finishing early - HelpLinkUri: https://TODO/r9a061 + Title: Consider removing unnecessary conditional access operator (?) + Description: Using the conditional access operator (?) to access values which are statically known not to be null causes superfluous null checks to be performed at runtime DefaultSeverity: Warning Tier: 1 Attributes: general: - Severity: None - production: Severity: Warning diff --git a/eng/Diags/Microsoft.Analyzers.Local.yml b/eng/Diags/Microsoft.Analyzers.Local.yml index 2bef7a5eab0..524a2eb88fc 100644 --- a/eng/Diags/Microsoft.Analyzers.Local.yml +++ b/eng/Diags/Microsoft.Analyzers.Local.yml @@ -1,13 +1,12 @@ Origin: - AssemblyName: Microsoft.Extensions.LocalAnalyzers + AssemblyName: Microsoft.Analyzers.Local Version: 42.42.42.42424 Diagnostics: - R9A014: + LA0002: Metadata: Category: Performance - Title: Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance - Description: Recommends replacing explicit argument throwing with the more efficient 'Microsoft.Extensions.Diagnostics.Throws' class - HelpLinkUri: https://TODO/r9a014 + Title: Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance + Description: "'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' provides caching for common numeric values, avoiding the need to allocate new strings in many situations" DefaultSeverity: Warning Tier: 1 Attributes: @@ -15,12 +14,11 @@ Diagnostics: Severity: None performance: Severity: Warning - R9A015: + LA0001: Metadata: Category: Performance Title: Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance Description: Recommends replacing explicit argument throwing with the more efficient 'Microsoft.Shared.Diagnostics.Throws' class - HelpLinkUri: https://TODO/r9a015 DefaultSeverity: Warning Tier: 1 Attributes: @@ -28,12 +26,11 @@ Diagnostics: Severity: None performance: Severity: Warning - R9A036: + LA0000: Metadata: Category: Performance - Title: Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance - Description: "'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' provides caching for common numeric values, avoiding the need to allocate new strings in many situations" - HelpLinkUri: https://TODO/r9a036 + Title: Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance + Description: Recommends replacing explicit argument throwing with the more efficient 'Microsoft.Extensions.Diagnostics.Throws' class DefaultSeverity: Warning Tier: 1 Attributes: @@ -41,90 +38,60 @@ Diagnostics: Severity: None performance: Severity: Warning - R9A049: + LA0003: Metadata: Category: Correctness Title: Newly added symbols must be marked as experimental Description: Symbols being added to the public API of an assembly must be marked as experimental until they have been appoved - HelpLinkUri: https://TODO/r9a049 - DefaultSeverity: None + DefaultSeverity: Warning Tier: 1 Attributes: general: Severity: None api: Severity: Warning - R9A050: + LA0004: Metadata: Category: Correctness Title: Experimental symbols cannot be marked as obsolete Description: Symbols being added to the public API of an assembly cannot be marked as obsolete - HelpLinkUri: https://TODO/r9a050 - DefaultSeverity: None + DefaultSeverity: Warning Tier: 1 Attributes: general: Severity: None api: Severity: Warning - R9A051: + LA0005: Metadata: Category: Correctness Title: Published symbols cannot be marked experimental Description: Previously published symbols in the public API of an assembly cannot be marked experimental - HelpLinkUri: https://TODO/r9a051 - DefaultSeverity: None + DefaultSeverity: Warning Tier: 1 Attributes: general: Severity: None api: Severity: Warning - R9A052: + LA0006: Metadata: Category: Correctness Title: Published symbols cannot be deleted to maintain compatibility Description: Published symbols cannot be deleted to maintain compatibility - HelpLinkUri: https://TODO/r9a052 - DefaultSeverity: None - Tier: 1 - Attributes: - general: - Severity: None - api: - Severity: Warning - R9A053: - Metadata: - Category: Correctness - Title: A deprecated API is not annotated with the obsolete attribute - Description: Deprecated API should have annotation that will guide customers regarding its replacement and the release in which it will be removed - HelpLinkUri: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 - Tier: 1 - Attributes: - general: - general: - Severity: None - api: - Severity: Warning - R9A054: - Metadata: - Category: Correctness - Title: A deprecated API is marked as experimental - Description: Deprecated API cannot be marked as experimental - HelpLinkUri: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 + DefaultSeverity: Warning Tier: 1 Attributes: general: Severity: None api: Severity: Warning - R9A055: + LA0007: Metadata: Category: Correctness Title: Published symbols cannot be changed to maintain compatibility Description: Published symbols cannot change to maintain compatibility - HelpLinkUri: https://TODO/r9a055 - DefaultSeverity: None + DefaultSeverity: Warning Tier: 1 Attributes: general: diff --git a/eng/Diags/Microsoft.AspNetCore.Components.Analyzers.yml b/eng/Diags/Microsoft.AspNetCore.Components.Analyzers.yml index 9c154e98c64..a7da7ee84a5 100644 --- a/eng/Diags/Microsoft.AspNetCore.Components.Analyzers.yml +++ b/eng/Diags/Microsoft.AspNetCore.Components.Analyzers.yml @@ -1,6 +1,6 @@ Origin: AssemblyName: Microsoft.AspNetCore.Components.Analyzers - Version: 7.0.423.11903 + Version: 8.0.23.35902 Diagnostics: BL0001: Metadata: diff --git a/eng/Diags/Microsoft.CodeAnalysis.CSharp.CodeStyle.yml b/eng/Diags/Microsoft.CodeAnalysis.CSharp.CodeStyle.yml index 579a215c9f7..e0307e9eea4 100644 --- a/eng/Diags/Microsoft.CodeAnalysis.CSharp.CodeStyle.yml +++ b/eng/Diags/Microsoft.CodeAnalysis.CSharp.CodeStyle.yml @@ -1,6 +1,6 @@ Origin: AssemblyName: Microsoft.CodeAnalysis.CSharp.CodeStyle - Version: 4.7.8.26202 + Version: 4.8.8.35803 Diagnostics: IDE0001: Metadata: @@ -57,7 +57,7 @@ Diagnostics: IDE0053: Metadata: Category: Style - Title: Use block body for lambda expression + Title: Use expression body for lambda expression Description: '' HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0053 CustomTags: @@ -1010,7 +1010,7 @@ Diagnostics: IDE0073: Metadata: Category: Style - Title: The file header does not match the required text + Title: The file header is missing or not located at the top of the file Description: '' HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0073 CustomTags: @@ -1743,3 +1743,45 @@ Diagnostics: Attributes: general: Severity: None + IDE0290: + Metadata: + Category: Style + Title: Use primary constructor + Description: '' + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0290 + CustomTags: + - Telemetry + - EnforceOnBuild_Recommended + DefaultSeverity: None + Tier: 1 + Attributes: + general: + Severity: None + IDE0301: + Metadata: + Category: Style + Title: Simplify collection initialization + Description: '' + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0301 + CustomTags: + - Telemetry + - EnforceOnBuild_Recommended + DefaultSeverity: None + Tier: 1 + Attributes: + general: + Severity: Suggestion + IDE0300: + Metadata: + Category: Style + Title: Simplify collection initialization + Description: '' + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0300 + CustomTags: + - Telemetry + - EnforceOnBuild_Recommended + DefaultSeverity: None + Tier: 1 + Attributes: + general: + Severity: None diff --git a/eng/Diags/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.yml b/eng/Diags/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.yml index d36a7cbf2c0..43490bdc8f0 100644 --- a/eng/Diags/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.yml +++ b/eng/Diags/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.yml @@ -1,6 +1,6 @@ Origin: AssemblyName: Microsoft.CodeAnalysis.CSharp.NetAnalyzers - Version: 8.0.8.26002 + Version: 8.0.8.35701 Diagnostics: CA1001: Metadata: @@ -426,7 +426,7 @@ Diagnostics: Metadata: Category: Performance Title: Use literals where appropriate - Description: A field is declared static and read-only (Shared and ReadOnly in Visual Basic), and is initialized by using a value that is computable at compile time. Because the value that is assigned to the targeted field is computable at compile time, change the declaration to a const (Const in Visual Basic) field so that the value is computed at compile time instead of at run?time. + Description: A field is declared static and read-only (Shared and ReadOnly in Visual Basic), and is initialized by using a value that is computable at compile time. Because the value that is assigned to the targeted field is computable at compile time, change the declaration to a const (Const in Visual Basic) field so that the value is computed at compile time instead of at runtime. HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1802 CustomTags: - PortedFromFxCop @@ -540,3 +540,60 @@ Diagnostics: Attributes: general: Severity: Warning + CA1865: + Metadata: + Category: Performance + Title: Use char overload + Description: The char overload is a better performing overload than a string with a single char. + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 + CustomTags: + - Telemetry + - EnabledRuleInAggressiveMode + DefaultSeverity: Suggestion + Tier: 1 + Attributes: + general: + Severity: Suggestion + CA1866: + Metadata: + Category: Performance + Title: Use char overload + Description: The char overload is a better performing overload than a string with a single char. + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 + CustomTags: + - Telemetry + - EnabledRuleInAggressiveMode + DefaultSeverity: Suggestion + Tier: 1 + Attributes: + general: + Severity: Suggestion + CA1867: + Metadata: + Category: Performance + Title: Use char overload + Description: The char overload is a better performing overload than a string with a single char. + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 + CustomTags: + - Telemetry + - EnabledRuleInAggressiveMode + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: Warning + CA1508: + Metadata: + Category: Maintainability + Title: Avoid dead conditional code + Description: '' + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 + CustomTags: + - Dataflow + - Telemetry + - EnabledRuleInAggressiveMode + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: Warning diff --git a/eng/Diags/Microsoft.CodeAnalysis.CodeStyle.yml b/eng/Diags/Microsoft.CodeAnalysis.CodeStyle.yml index e0069a1925e..656ea970d10 100644 --- a/eng/Diags/Microsoft.CodeAnalysis.CodeStyle.yml +++ b/eng/Diags/Microsoft.CodeAnalysis.CodeStyle.yml @@ -1,6 +1,6 @@ Origin: AssemblyName: Microsoft.CodeAnalysis.CodeStyle - Version: 4.7.8.26202 + Version: 4.8.8.35803 Diagnostics: IDE0033: Metadata: diff --git a/eng/Diags/Microsoft.CodeAnalysis.NetAnalyzers.yml b/eng/Diags/Microsoft.CodeAnalysis.NetAnalyzers.yml index a6f4be367df..59edace3dd4 100644 --- a/eng/Diags/Microsoft.CodeAnalysis.NetAnalyzers.yml +++ b/eng/Diags/Microsoft.CodeAnalysis.NetAnalyzers.yml @@ -1,6 +1,6 @@ Origin: AssemblyName: Microsoft.CodeAnalysis.NetAnalyzers - Version: 8.0.8.26002 + Version: 8.0.8.35701 Diagnostics: CA1000: Metadata: @@ -3906,7 +3906,7 @@ Diagnostics: Attributes: general: Severity: None - Comment: Use R9 logging model instead + Comment: Use the code generated model instead. CA2253: Metadata: Category: Usage @@ -4222,7 +4222,8 @@ Diagnostics: Attributes: general: Severity: None - Redundant: R9A013 + performance: + Redundant: Warning CA2259: Metadata: Category: Usage @@ -4329,7 +4330,7 @@ Diagnostics: Metadata: Category: Performance Title: Avoid constant arrays as arguments - Description: Constant arrays passed as arguments are not reused which implies a performance overhead. Consider extracting them to 'static readonly' fields to improve performance. + Description: Constant arrays passed as arguments are not reused when called repeatedly, which implies a new array is created each time. Consider extracting them to 'static readonly' fields to improve performance if the passed array is not mutated within the called method. HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 CustomTags: - Telemetry @@ -4429,7 +4430,9 @@ Diagnostics: Tier: 1 Attributes: general: - Severity: Suggestion + Severity: None + performance: + Severity: Warning CA1859: Metadata: Category: Performance @@ -4443,7 +4446,9 @@ Diagnostics: Tier: 1 Attributes: general: - Severity: Suggestion + Severity: None + performance: + Severity: Warning CA1858: Metadata: Category: Performance @@ -4455,6 +4460,101 @@ Diagnostics: - EnabledRuleInAggressiveMode DefaultSeverity: Suggestion Tier: 1 + Attributes: + general: + Severity: None + performance: + Severity: Warning + CA2261: + Metadata: + Category: Usage + Title: Do not use ConfigureAwaitOptions.SuppressThrowing with Task + Description: The ConfigureAwaitOptions.SuppressThrowing is only supported with the non-generic Task, not a Task. To use it with a Task, first cast to the base Task. + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 + CustomTags: + - Telemetry + - EnabledRuleInAggressiveMode + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: Warning + CA1868: + Metadata: + Category: Performance + Title: Unnecessary call to 'Contains(item)' + Description: Do not guard 'Add(item)' or 'Remove(item)' with 'Contains(item)' for the set. The former two already check whether the item exists and will return if it was added or removed. + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 + CustomTags: + - Telemetry + - EnabledRuleInAggressiveMode + DefaultSeverity: Suggestion + Tier: 1 + Attributes: + general: + Severity: Suggestion + performance: + Severity: Warning + CA1864: + Metadata: + Category: Performance + Title: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method + Description: Prefer a 'TryAdd' call over an 'Add' call guarded by a 'ContainsKey' check. 'TryAdd' behaves the same as 'Add', except that when the specified key already exists, it returns 'false' instead of throwing an exception. + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 + CustomTags: + - Telemetry + - EnabledRuleInAggressiveMode + DefaultSeverity: Suggestion + Tier: 1 Attributes: general: Severity: Suggestion + performance: + Severity: Warning + CA1862: + Metadata: + Category: Performance + Title: Prefer using 'StringComparer' to perform case-insensitive string comparisons + Description: Avoid calling 'ToLower', 'ToUpper', 'ToLowerInvariant' and 'ToUpperInvariant' to perform case-insensitive string comparisons when using 'CompareTo', because they lead to an allocation. Instead, use 'StringComparer' to perform case-insensitive comparisons. + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 + CustomTags: + - Telemetry + - EnabledRuleInAggressiveMode + DefaultSeverity: Suggestion + Tier: 1 + Attributes: + general: + Severity: None + performance: + Severity: Warning + CA1863: + Metadata: + Category: Performance + Title: Use 'CompositeFormat' + Description: Cache and use a 'CompositeFormat' instance as the argument to this formatting operation, rather than passing in the original format string. This reduces the cost of the formatting operation. + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 + CustomTags: + - Telemetry + - EnabledRuleInAggressiveMode + DefaultSeverity: None + Tier: 1 + Attributes: + general: + Severity: None + performance: + Severity: Warning + CA1001: + Metadata: + Category: Design + Title: Types that own disposable fields should be disposable + Description: A class declares and implements an instance field that is a System.IDisposable type, and the class does not implement IDisposable. A class that declares an IDisposable field indirectly owns an unmanaged resource and should implement the IDisposable interface. + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 + CustomTags: + - PortedFromFxCop + - Telemetry + - EnabledRuleInAggressiveMode + DefaultSeverity: None + Tier: 2 + Attributes: + general: + Severity: Warning diff --git a/eng/Diags/SonarAnalyzer.CSharp.yml b/eng/Diags/SonarAnalyzer.CSharp.yml index bd63f3051d5..aad858b48d3 100644 --- a/eng/Diags/SonarAnalyzer.CSharp.yml +++ b/eng/Diags/SonarAnalyzer.CSharp.yml @@ -6242,7 +6242,7 @@ Diagnostics: Attributes: general: Severity: None - Redundant: R9A013 + Redundant: CA1852 S3059: Metadata: Category: Major Code Smell @@ -6286,7 +6286,7 @@ Diagnostics: Attributes: general: Severity: None - Redundant: R9A022 + Redundant: EA0002 S6422: Metadata: Category: Blocker Code Smell diff --git a/eng/Diags/StyleCop.Analyzers.yml b/eng/Diags/StyleCop.Analyzers.yml index e000d6ab07b..bdee2a5d5b4 100644 --- a/eng/Diags/StyleCop.Analyzers.yml +++ b/eng/Diags/StyleCop.Analyzers.yml @@ -1,6 +1,6 @@ Origin: AssemblyName: StyleCop.Analyzers - Version: 1.2.0.435 + Version: 1.2.0.507 Diagnostics: SA0001: Metadata: @@ -8,6 +8,8 @@ Diagnostics: Title: XML comment analysis disabled Description: XML comment analysis can only be performed when the project is configured to parse documentation comments. To enable this functionality, update the project to produce an XML documentation file as part of the build. HelpLinkUri: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA0001.md + CustomTags: + - CompilationEnd DefaultSeverity: Warning Tier: 2 Attributes: @@ -21,9 +23,10 @@ Diagnostics: Various errors in the stylecop.json file can prevent the file from being loaded by the analyzers. In this case, the default settings are used instead. - {0} HelpLinkUri: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA0002.md + CustomTags: + - CompilationEnd DefaultSeverity: Warning Tier: 1 Attributes: diff --git a/eng/Diags/xunit.analyzers.yml b/eng/Diags/xunit.analyzers.yml index 60ceb1b082d..14cd9142f48 100644 --- a/eng/Diags/xunit.analyzers.yml +++ b/eng/Diags/xunit.analyzers.yml @@ -1,6 +1,6 @@ Origin: AssemblyName: xunit.analyzers - Version: 1.0.0 + Version: 1.1.0 Diagnostics: xUnit1000: Metadata: diff --git a/eng/Tools/.editorconfig b/eng/Tools/.editorconfig index 907f79f6f42..d4e6af326f8 100644 --- a/eng/Tools/.editorconfig +++ b/eng/Tools/.editorconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:52Z +# Generated : 2023-08-07 17:59:54Z # Max Tier : 2147483647 # Attributes: general -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers [*.cs] @@ -104,6 +104,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = warning +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = warning + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -471,6 +476,11 @@ dotnet_diagnostic.CA1507.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 dotnet_diagnostic.CA1508.severity = warning +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Invalid entry in code metrics rule specification file # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509 @@ -788,7 +798,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use R9 logging model instead +# Comment : Use the code generated model instead. dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -809,7 +819,6 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -# Redundant: R9A013 dotnet_diagnostic.CA1852.severity = none # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' @@ -840,23 +849,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = none # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = none # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = none + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = none + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = suggestion + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1172,6 +1216,11 @@ dotnet_diagnostic.CA2259.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = warning +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1667,6 +1716,66 @@ dotnet_diagnostic.CA5404.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = none +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = none + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = none + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = none + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = none + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = none + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = none + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = none + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = none + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = none + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = none + # Title : Set MSBuild property 'GenerateDocumentationFile' to 'true' # Category : Style # Help Link: https://github.com/dotnet/roslyn/issues/41640 @@ -1965,7 +2074,7 @@ dotnet_diagnostic.IDE0051.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0052 dotnet_diagnostic.IDE0052.severity = warning -# Title : Use block body for lambda expression +# Title : Use expression body for lambda expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0053 # Comment : This metadata was entered manually, since it is not exposed in the normal way from the analyzer assembly. @@ -2103,7 +2212,7 @@ dotnet_style_prefer_simplified_interpolation = true # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0072 dotnet_diagnostic.IDE0072.severity = silent -# Title : The file header does not match the required text +# Title : The file header is missing or not located at the top of the file # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0073 dotnet_diagnostic.IDE0073.severity = warning @@ -2282,6 +2391,21 @@ dotnet_diagnostic.IDE0270.severity = silent # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0280 dotnet_diagnostic.IDE0280.severity = silent +# Title : Use primary constructor +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0290 +dotnet_diagnostic.IDE0290.severity = none + +# Title : Simplify collection initialization +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0300 +dotnet_diagnostic.IDE0300.severity = none + +# Title : Simplify collection initialization +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0301 +dotnet_diagnostic.IDE0301.severity = suggestion + # Title : Delegate invocation can be simplified. # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1005 @@ -2583,7 +2707,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = warning @@ -2665,155 +2789,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = none - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = none +dotnet_diagnostic.LA0000.severity = none # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = none - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = none - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = none - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = none - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = none - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = none - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = none - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = none - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = none - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = none +dotnet_diagnostic.LA0001.severity = none # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = none - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = none - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = none - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = none - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = none +dotnet_diagnostic.LA0002.severity = none # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = none +dotnet_diagnostic.LA0003.severity = none # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = none +dotnet_diagnostic.LA0004.severity = none # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = none +dotnet_diagnostic.LA0005.severity = none # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = none - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = none - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = none +dotnet_diagnostic.LA0006.severity = none # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = none - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = none +dotnet_diagnostic.LA0007.severity = none # Title : # Category : Style @@ -3593,7 +3599,8 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3902,7 +3909,7 @@ dotnet_diagnostic.S3257.severity = warning # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: R9A013 +# Redundant: CA1852 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4866,7 +4873,7 @@ dotnet_diagnostic.S5773.severity = warning # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/eng/Tools/ApiChief/ApiChief.csproj b/eng/Tools/ApiChief/ApiChief.csproj index 231a53ab8f1..a0c6055c21c 100644 --- a/eng/Tools/ApiChief/ApiChief.csproj +++ b/eng/Tools/ApiChief/ApiChief.csproj @@ -5,10 +5,6 @@ Tool to help with .NET API management activities - - $(NoWarn);R9A061;R9A044 - - diff --git a/eng/Tools/DiagConfig/DiagConfig.csproj b/eng/Tools/DiagConfig/DiagConfig.csproj index c9eff412c95..6ce56c853ce 100644 --- a/eng/Tools/DiagConfig/DiagConfig.csproj +++ b/eng/Tools/DiagConfig/DiagConfig.csproj @@ -5,10 +5,6 @@ Tool to manipulate diagnostic YAML files and .editorconfig files - - $(NoWarn);R9A061;R9A043;R9A022;R9A033 - - diff --git a/eng/Tools/DiagConfig/README.md b/eng/Tools/DiagConfig/README.md index eca68e418b8..93f3b4f6e42 100644 --- a/eng/Tools/DiagConfig/README.md +++ b/eng/Tools/DiagConfig/README.md @@ -19,7 +19,7 @@ Here's an example diagnostic: ```yaml Diagnostics: - R9A001: + EA0001: Metadata: Category: Performance Title: Switch to `Microsoft.IO.RecyclableMemoryStream` for additional performance. diff --git a/eng/packages/General.props b/eng/packages/General.props index 57d9a6e9788..3c8ebb9ddf5 100644 --- a/eng/packages/General.props +++ b/eng/packages/General.props @@ -63,7 +63,7 @@ - + diff --git a/scripts/MakeEditorConfigs.ps1 b/scripts/MakeEditorConfigs.ps1 index cf6b78103b1..b85e0534ad3 100644 --- a/scripts/MakeEditorConfigs.ps1 +++ b/scripts/MakeEditorConfigs.ps1 @@ -18,7 +18,6 @@ Write-Output "Creating .editorconfig files" & $Command $Diags editorconfig save --exclude xunit.analyzers src/Analyzers/.editorconfig general,performance,production & $Command $Diags editorconfig save --exclude xunit.analyzers src/Generators/.editorconfig general,performance,production & $Command $Diags editorconfig save --exclude xunit.analyzers src/Libraries/.editorconfig general,api,performance,production -& $Command $Diags editorconfig save --exclude xunit.analyzers src/ToBeMoved/.editorconfig general,performance,production & $Command $Diags editorconfig save --exclude xunit.analyzers src/ToBeRemoved/.editorconfig general,performance,production & $Command $Diags editorconfig save --exclude xunit.analyzers src/LegacySupport/.editorconfig general,performance,production & $Command $Diags editorconfig save --exclude xunit.analyzers src/Shared/.editorconfig general,performance,production @@ -28,26 +27,26 @@ Write-Output "Creating .editorconfig files" # The files we publish with the M.E.StaticAnalysis package -& $Command $Diags editorconfig save --max-tier 1 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier1.globalconfig general,general_externalonly --is-global -& $Command $Diags editorconfig save --max-tier 1 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier1.globalconfig general,general_externalonly,performance,production --is-global -& $Command $Diags editorconfig save --max-tier 1 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier1.globalconfig general,general_externalonly,api,performance,production --is-global -& $Command $Diags editorconfig save --max-tier 1 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier1.globalconfig general,general_externalonly --is-global -& $Command $Diags editorconfig save --max-tier 1 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier1.globalconfig general,general_externalonly,api --is-global -& $Command $Diags editorconfig save --max-tier 1 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier1.globalconfig general,general_externalonly,performance --is-global -& $Command $Diags editorconfig save --max-tier 1 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier1.globalconfig general,general_externalonly,test --is-global - -& $Command $Diags editorconfig save --max-tier 2 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier2.globalconfig general,general_externalonly --is-global -& $Command $Diags editorconfig save --max-tier 2 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier2.globalconfig general,general_externalonly,performance,production --is-global -& $Command $Diags editorconfig save --max-tier 2 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier2.globalconfig general,general_externalonly,api,performance,production --is-global -& $Command $Diags editorconfig save --max-tier 2 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier2.globalconfig general,general_externalonly --is-global -& $Command $Diags editorconfig save --max-tier 2 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier2.globalconfig general,general_externalonly,api --is-global -& $Command $Diags editorconfig save --max-tier 2 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier2.globalconfig general,general_externalonly,performance --is-global -& $Command $Diags editorconfig save --max-tier 2 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier2.globalconfig general,general_externalonly,test --is-global - -& $Command $Diags editorconfig save --max-tier 3 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General.globalconfig general,general_externalonly --is-global -& $Command $Diags editorconfig save --max-tier 3 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe.globalconfig general,general_externalonly,performance,production --is-global -& $Command $Diags editorconfig save --max-tier 3 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib.globalconfig general,general_externalonly,api,performance,production --is-global -& $Command $Diags editorconfig save --max-tier 3 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe.globalconfig general,general_externalonly --is-global -& $Command $Diags editorconfig save --max-tier 3 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib.globalconfig general,general_externalonly,api --is-global -& $Command $Diags editorconfig save --max-tier 3 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark.globalconfig general,general_externalonly,performance --is-global -& $Command $Diags editorconfig save --max-tier 3 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test.globalconfig general,general_externalonly,test --is-global +& $Command $Diags editorconfig save --max-tier 1 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier1.globalconfig general --is-global +& $Command $Diags editorconfig save --max-tier 1 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier1.globalconfig general,performance,production --is-global +& $Command $Diags editorconfig save --max-tier 1 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier1.globalconfig general,api,performance,production --is-global +& $Command $Diags editorconfig save --max-tier 1 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier1.globalconfig general --is-global +& $Command $Diags editorconfig save --max-tier 1 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier1.globalconfig general,api --is-global +& $Command $Diags editorconfig save --max-tier 1 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier1.globalconfig general,performance --is-global +& $Command $Diags editorconfig save --max-tier 1 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier1.globalconfig general,test --is-global + +& $Command $Diags editorconfig save --max-tier 2 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier2.globalconfig general --is-global +& $Command $Diags editorconfig save --max-tier 2 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier2.globalconfig general,performance,production --is-global +& $Command $Diags editorconfig save --max-tier 2 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier2.globalconfig general,api,performance,production --is-global +& $Command $Diags editorconfig save --max-tier 2 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier2.globalconfig general --is-global +& $Command $Diags editorconfig save --max-tier 2 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier2.globalconfig general,api --is-global +& $Command $Diags editorconfig save --max-tier 2 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier2.globalconfig general,performance --is-global +& $Command $Diags editorconfig save --max-tier 2 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier2.globalconfig general,test --is-global + +& $Command $Diags editorconfig save --max-tier 3 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General.globalconfig general --is-global +& $Command $Diags editorconfig save --max-tier 3 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe.globalconfig general,performance,production --is-global +& $Command $Diags editorconfig save --max-tier 3 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib.globalconfig general,api,performance,production --is-global +& $Command $Diags editorconfig save --max-tier 3 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe.globalconfig general --is-global +& $Command $Diags editorconfig save --max-tier 3 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib.globalconfig general,api --is-global +& $Command $Diags editorconfig save --max-tier 3 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle,xunit.analyzers src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark.globalconfig general,performance --is-global +& $Command $Diags editorconfig save --max-tier 3 --exclude StyleCop.Analyzers,Microsoft.CodeAnalysis.CodeStyle,Microsoft.CodeAnalysis.CSharp.CodeStyle src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test.globalconfig general,test --is-global diff --git a/scripts/MergeAnalyzerMetadata.ps1 b/scripts/MergeAnalyzerMetadata.ps1 index d342d453e46..34b9f66d9fb 100644 --- a/scripts/MergeAnalyzerMetadata.ps1 +++ b/scripts/MergeAnalyzerMetadata.ps1 @@ -16,32 +16,47 @@ Write-Output "Creating solution file" Write-Output "Restoring packages" & dotnet restore --nologo --verbosity q -# $DotnetVersion = & dotnet --version -$DotNetVersion = "8.0.100-preview.5.23262.6" - $Artifacts = Join-Path -Path $PSScriptRoot -ChildPath "\..\artifacts" -Resolve $DiagToolPath = "$Artifacts\bin\DiagConfig\Debug\net8.0\*" -$Command = "$Artifacts\bin\DiagConfig\Debug\net8.0\DiagConfig.exe" $Diags = (Resolve-Path $PSScriptRoot).Path + "\..\eng\Diags" -#$DotnetPath = Split-Path -Path (get-command dotnet.exe).Path -Parent -$DotnetPath = "C:\Program Files\dotnet" -$RoslynPath = "$DotnetPath\sdk\$DotnetVersion\Roslyn\bincore" -$CodeStylePath = "$DotnetPath\sdk\$DotnetVersion\Sdks\Microsoft.NET.Sdk\codestyle\cs" -$NetAnalyzersPath = "$DotnetPath\sdk\$DotnetVersion\Sdks\Microsoft.NET.Sdk\analyzers" -$PackagePath = Join-Path -Path $Home -ChildPath ".nuget/packages" -Resolve -$AspNetCorePath = Join-Path -Path $DotNetPath -ChildPath packs\Microsoft.AspNetCore.App.Ref\7.0.4\analyzers\dotnet\cs - -Write-Output "Processing analyzer assemblies" -& $Command $Diags analyzer merge $Artifacts\bin\Microsoft.Analyzers.Extra\Debug\netstandard2.0\Microsoft.Analyzers.Extra.dll -& $Command $Diags analyzer merge $Artifacts\bin\Microsoft.Analyzers.Local\Debug\netstandard2.0\Microsoft.Analyzers.Local.dll -& $Command $Diags analyzer merge $PackagePath\stylecop.analyzers.unstable\1.2.0.435\analyzers\dotnet\cs\StyleCop.Analyzers.dll -& $Command $Diags analyzer merge $PackagePath\sonaranalyzer.csharp\8.52.0.60960\analyzers\SonarAnalyzer.CSharp.dll -& $Command $Diags analyzer merge $PackagePath\microsoft.visualstudio.threading.analyzers\17.5.22\analyzers\cs\Microsoft.VisualStudio.Threading.Analyzers.dll -& $Command $Diags analyzer merge $PackagePath\microsoft.visualstudio.threading.analyzers\17.5.22\analyzers\cs\Microsoft.VisualStudio.Threading.Analyzers.CSharp.dll -& $Command $Diags analyzer merge $PackagePath\xunit.analyzers\1.0.0\analyzers\dotnet\cs\xunit.analyzers.dll +# TODO: needs to be auto-generated. This is a dump of the Analyzers items when compiling test/libraries/microsoft.aspnetcore.asyncstate +$analyzers = @( + 'C:\src\dotnet\extensions\.dotnet\sdk\8.0.100-preview.7.23360.1\Sdks\Microsoft.NET.Sdk\targets\..\analyzers\Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll' + 'C:\src\dotnet\extensions\.dotnet\sdk\8.0.100-preview.7.23360.1\Sdks\Microsoft.NET.Sdk\targets\..\analyzers\Microsoft.CodeAnalysis.NetAnalyzers.dll' + 'C:\src\dotnet\extensions\.dotnet\sdk\8.0.100-preview.7.23360.1\Sdks\Microsoft.NET.Sdk\targets\..\codestyle\cs\Microsoft.CodeAnalysis.CodeStyle.dll' + 'C:\src\dotnet\extensions\.dotnet\sdk\8.0.100-preview.7.23360.1\Sdks\Microsoft.NET.Sdk\targets\..\codestyle\cs\Microsoft.CodeAnalysis.CodeStyle.Fixes.dll' + 'C:\src\dotnet\extensions\.dotnet\sdk\8.0.100-preview.7.23360.1\Sdks\Microsoft.NET.Sdk\targets\..\codestyle\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll' + 'C:\src\dotnet\extensions\.dotnet\sdk\8.0.100-preview.7.23360.1\Sdks\Microsoft.NET.Sdk\targets\..\codestyle\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes.dll' + 'C:\Users\mataille\.nuget\packages\microsoft.extensions.logging.abstractions\8.0.0-rc.1.23402.13\analyzers\dotnet\roslyn4.4\cs\Microsoft.Extensions.Logging.Generators.dll' + 'C:\Users\mataille\.nuget\packages\microsoft.extensions.options\8.0.0-rc.1.23402.13\analyzers\dotnet\roslyn4.4\cs\Microsoft.Extensions.Options.SourceGeneration.dll' + 'C:\Users\mataille\.nuget\packages\microsoft.net.illink.tasks\8.0.0-preview.7.23359.1\analyzers\dotnet\cs\ILLink.CodeFixProvider.dll' + 'C:\Users\mataille\.nuget\packages\microsoft.net.illink.tasks\8.0.0-preview.7.23359.1\analyzers\dotnet\cs\ILLink.RoslynAnalyzer.dll' + 'C:\Users\mataille\.nuget\packages\microsoft.visualstudio.threading.analyzers\17.5.22\analyzers\cs\Microsoft.VisualStudio.Threading.Analyzers.CSharp.dll' + 'C:\Users\mataille\.nuget\packages\microsoft.visualstudio.threading.analyzers\17.5.22\analyzers\cs\Microsoft.VisualStudio.Threading.Analyzers.CodeFixes.dll' + 'C:\Users\mataille\.nuget\packages\microsoft.visualstudio.threading.analyzers\17.5.22\analyzers\cs\Microsoft.VisualStudio.Threading.Analyzers.dll' + 'C:\Users\mataille\.nuget\packages\sonaranalyzer.csharp\8.52.0.60960\analyzers\Google.Protobuf.dll' + 'C:\Users\mataille\.nuget\packages\sonaranalyzer.csharp\8.52.0.60960\analyzers\SonarAnalyzer.CFG.dll' + 'C:\Users\mataille\.nuget\packages\sonaranalyzer.csharp\8.52.0.60960\analyzers\SonarAnalyzer.CSharp.dll' + 'C:\Users\mataille\.nuget\packages\sonaranalyzer.csharp\8.52.0.60960\analyzers\SonarAnalyzer.dll' + 'C:\Users\mataille\.nuget\packages\stylecop.analyzers.unstable\1.2.0.507\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll' + 'C:\Users\mataille\.nuget\packages\stylecop.analyzers.unstable\1.2.0.507\analyzers\dotnet\cs\StyleCop.Analyzers.dll' + 'C:\src\dotnet\extensions\artifacts\bin\Microsoft.Analyzers.Extra\Debug\netstandard2.0\Microsoft.Analyzers.Extra.dll' + 'C:\src\dotnet\extensions\artifacts\bin\Microsoft.Analyzers.Local\Debug\netstandard2.0\Microsoft.Analyzers.Local.dll' + 'C:\src\dotnet\extensions\.dotnet\packs\Microsoft.NETCore.App.Ref\8.0.0-preview.7.23359.1\analyzers/dotnet/cs/Microsoft.Interop.ComInterfaceGenerator.dll' + 'C:\src\dotnet\extensions\.dotnet\packs\Microsoft.NETCore.App.Ref\8.0.0-preview.7.23359.1\analyzers/dotnet/cs/Microsoft.Interop.JavaScript.JSImportGenerator.dll' + 'C:\src\dotnet\extensions\.dotnet\packs\Microsoft.NETCore.App.Ref\8.0.0-preview.7.23359.1\analyzers/dotnet/cs/Microsoft.Interop.LibraryImportGenerator.dll' + 'C:\src\dotnet\extensions\.dotnet\packs\Microsoft.NETCore.App.Ref\8.0.0-preview.7.23359.1\analyzers/dotnet/cs/Microsoft.Interop.SourceGeneration.dll' + 'C:\src\dotnet\extensions\.dotnet\packs\Microsoft.NETCore.App.Ref\8.0.0-preview.7.23359.1\analyzers/dotnet/cs/System.Text.Json.SourceGeneration.dll' + 'C:\src\dotnet\extensions\.dotnet\packs\Microsoft.NETCore.App.Ref\8.0.0-preview.7.23359.1\analyzers/dotnet/cs/System.Text.RegularExpressions.Generator.dll' + 'C:\src\dotnet\extensions\.dotnet\packs\Microsoft.AspNetCore.App.Ref\8.0.0-preview.7.23359.2\analyzers/dotnet/cs/Microsoft.AspNetCore.App.Analyzers.dll' + 'C:\src\dotnet\extensions\.dotnet\packs\Microsoft.AspNetCore.App.Ref\8.0.0-preview.7.23359.2\analyzers/dotnet/cs/Microsoft.AspNetCore.App.CodeFixes.dll' + 'C:\src\dotnet\extensions\.dotnet\packs\Microsoft.AspNetCore.App.Ref\8.0.0-preview.7.23359.2\analyzers/dotnet/cs/Microsoft.AspNetCore.Components.Analyzers.dll' + 'C:\Users\mataille\.nuget\packages\xunit.analyzers\1.1.0\analyzers\dotnet\cs\xunit.analyzers.dll' + 'C:\Users\mataille\.nuget\packages\xunit.analyzers\1.1.0\analyzers\dotnet\cs\xunit.analyzers.fixes.dll' +) -# voodoo for Microsoft.CodeAnalysis.* and Microsoft.AspNetCore.* +Write-Output "Processing analyzer assemblies" $tempDir = "$PSScriptRoot\Temp" @@ -52,23 +67,27 @@ if (-not (Test-Path -Path $tempDir)) { Push-Location $tempDir try { - Copy-Item -Path (Join-Path -Path $RoslynPath -ChildPath Microsoft.CodeAnalysis.dll -Resolve) -Destination $tempDir - Copy-Item -Path (Join-Path -Path $RoslynPath -ChildPath Microsoft.CodeAnalysis.CSharp.dll -Resolve) -Destination $tempDir - Copy-Item -Path (Join-Path -Path $CodeStylePath -ChildPath Microsoft.CodeAnalysis.CodeStyle.dll -Resolve) -Destination $tempDir - Copy-Item -Path (Join-Path -Path $CodeStylePath -ChildPath Microsoft.CodeAnalysis.CSharp.CodeStyle.dll -Resolve) -Destination $tempDir - Copy-Item -Path (Join-Path -Path $NetAnalyzersPath -ChildPath Microsoft.CodeAnalysis.NetAnalyzers.dll -Resolve) -Destination $tempDir - Copy-Item -Path (Join-Path -Path $NetAnalyzersPath -ChildPath Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll -Resolve) -Destination $tempDir - Copy-Item -Path (Join-Path -Path $NetAnalyzersPath -ChildPath ILlink.RoslynAnalyzer.dll -Resolve) -Destination $tempDir - Copy-Item -Path (Join-Path -Path $AspNetCorePath -ChildPath Microsoft.AspNetCore.App.Analyzers.dll -Resolve) -Destination $tempDir - Copy-Item -Path (Join-Path -Path $AspNetCorePath -ChildPath Microsoft.AspNetCore.Components.Analyzers.dll -Resolve) -Destination $tempDir + + foreach ( $a in $analyzers ) + { + Copy-Item -Path $a -Destination $tempDir + } + Copy-Item -Path $DiagToolPath -Destination $tempDir + & .\DiagConfig.exe $Diags analyzer merge Microsoft.Analyzers.Extra.dll + & .\DiagConfig.exe $Diags analyzer merge Microsoft.Analyzers.Local.dll + & .\DiagConfig.exe $Diags analyzer merge StyleCop.Analyzers.dll + & .\DiagConfig.exe $Diags analyzer merge SonarAnalyzer.CSharp.dll + & .\DiagConfig.exe $Diags analyzer merge Microsoft.VisualStudio.Threading.Analyzers.dll + & .\DiagConfig.exe $Diags analyzer merge Microsoft.VisualStudio.Threading.Analyzers.CSharp.dll + & .\DiagConfig.exe $Diags analyzer merge xunit.analyzers.dll & .\DiagConfig.exe $Diags analyzer merge Microsoft.CodeAnalysis.CodeStyle.dll & .\DiagConfig.exe $Diags analyzer merge Microsoft.CodeAnalysis.CSharp.CodeStyle.dll & .\DiagConfig.exe $Diags analyzer merge Microsoft.CodeAnalysis.NetAnalyzers.dll & .\DiagConfig.exe $Diags analyzer merge Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll & .\DiagConfig.exe $Diags analyzer merge ILlink.RoslynAnalyzer.dll - & .\DiagConfig.exe $Diags analyzer merge Microsoft.AspNetCore.App.Analyzers.dll +# & .\DiagConfig.exe $Diags analyzer merge Microsoft.AspNetCore.App.Analyzers.dll & .\DiagConfig.exe $Diags analyzer merge Microsoft.AspNetCore.Components.Analyzers.dll } finally { Pop-Location diff --git a/src/Analyzers/.editorconfig b/src/Analyzers/.editorconfig index be5b3fa69ab..b264953e5ea 100644 --- a/src/Analyzers/.editorconfig +++ b/src/Analyzers/.editorconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:50Z +# Generated : 2023-08-07 17:59:51Z # Max Tier : 2147483647 # Attributes: general, performance, production -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers [*.cs] @@ -104,6 +104,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = warning +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = warning + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -474,6 +479,11 @@ dotnet_diagnostic.CA1507.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 dotnet_diagnostic.CA1508.severity = warning +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Invalid entry in code metrics rule specification file # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509 @@ -791,7 +801,7 @@ dotnet_diagnostic.CA1847.severity = warning # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use R9 logging model instead +# Comment : Use the code generated model instead. dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -812,7 +822,6 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -# Redundant: R9A013 dotnet_diagnostic.CA1852.severity = none # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' @@ -843,23 +852,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = warning # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = warning # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = warning + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = warning + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = warning + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = warning + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1175,6 +1219,11 @@ dotnet_diagnostic.CA2259.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = warning +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1670,6 +1719,66 @@ dotnet_diagnostic.CA5404.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = warning +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = warning + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = warning + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = warning + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = warning + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = warning + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = warning + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = warning + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = warning + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = warning + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = warning + # Title : Set MSBuild property 'GenerateDocumentationFile' to 'true' # Category : Style # Help Link: https://github.com/dotnet/roslyn/issues/41640 @@ -1968,7 +2077,7 @@ dotnet_diagnostic.IDE0051.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0052 dotnet_diagnostic.IDE0052.severity = warning -# Title : Use block body for lambda expression +# Title : Use expression body for lambda expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0053 # Comment : This metadata was entered manually, since it is not exposed in the normal way from the analyzer assembly. @@ -2107,7 +2216,7 @@ dotnet_style_prefer_simplified_interpolation = true # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0072 dotnet_diagnostic.IDE0072.severity = silent -# Title : The file header does not match the required text +# Title : The file header is missing or not located at the top of the file # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0073 dotnet_diagnostic.IDE0073.severity = warning @@ -2286,6 +2395,21 @@ dotnet_diagnostic.IDE0270.severity = silent # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0280 dotnet_diagnostic.IDE0280.severity = silent +# Title : Use primary constructor +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0290 +dotnet_diagnostic.IDE0290.severity = none + +# Title : Simplify collection initialization +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0300 +dotnet_diagnostic.IDE0300.severity = none + +# Title : Simplify collection initialization +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0301 +dotnet_diagnostic.IDE0301.severity = suggestion + # Title : Delegate invocation can be simplified. # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1005 @@ -2587,7 +2711,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = warning @@ -2669,155 +2793,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = warning - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = warning +dotnet_diagnostic.LA0000.severity = warning # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = warning - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = warning - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = warning - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = warning - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = warning - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = warning - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = none - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = warning - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = warning - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = warning +dotnet_diagnostic.LA0001.severity = warning # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = warning - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = warning - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = warning - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = warning - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = warning +dotnet_diagnostic.LA0002.severity = warning # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = none +dotnet_diagnostic.LA0003.severity = none # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = none +dotnet_diagnostic.LA0004.severity = none # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = none +dotnet_diagnostic.LA0005.severity = none # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = none - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = none - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = none +dotnet_diagnostic.LA0006.severity = none # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = none - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = warning +dotnet_diagnostic.LA0007.severity = none # Title : # Category : Style @@ -3597,7 +3603,8 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3906,7 +3913,7 @@ dotnet_diagnostic.S3257.severity = warning # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: R9A013 +# Redundant: CA1852 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4870,7 +4877,7 @@ dotnet_diagnostic.S5773.severity = warning # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Analyzers/Microsoft.Analyzers.Extra/CallAnalysis/Fixers/LegacyLoggingFixer.cs b/src/Analyzers/Microsoft.Analyzers.Extra/CallAnalysis/Fixers/LegacyLoggingFixer.cs index 74cbde98129..554ecb5979d 100644 --- a/src/Analyzers/Microsoft.Analyzers.Extra/CallAnalysis/Fixers/LegacyLoggingFixer.cs +++ b/src/Analyzers/Microsoft.Analyzers.Extra/CallAnalysis/Fixers/LegacyLoggingFixer.cs @@ -335,7 +335,7 @@ private static string GetNamespace(ClassDeclarationSyntax cl) /// /// Given a LoggerExtensions method invocation, produce a parameter list for the corresponding generated logging method. /// - private static IReadOnlyList MakeParameterList( + private static List MakeParameterList( FixDetails details, IInvocationOperation invocationOp, SyntaxGenerator gen) @@ -401,7 +401,7 @@ private static IReadOnlyList MakeParameterList( /// /// Given a LoggerExtensions method invocation, produce an argument list in the shape of a corresponding generated logging method. /// - private static IReadOnlyList MakeArgumentList(FixDetails details, IInvocationOperation invocationOp) + private static List MakeArgumentList(FixDetails details, IInvocationOperation invocationOp) { var args = new List { diff --git a/src/Analyzers/Microsoft.Analyzers.Extra/CallAnalysis/LegacyLogging.cs b/src/Analyzers/Microsoft.Analyzers.Extra/CallAnalysis/LegacyLogging.cs index d64ef61d2ee..6b6aa70f6ed 100644 --- a/src/Analyzers/Microsoft.Analyzers.Extra/CallAnalysis/LegacyLogging.cs +++ b/src/Analyzers/Microsoft.Analyzers.Extra/CallAnalysis/LegacyLogging.cs @@ -9,7 +9,7 @@ namespace Microsoft.Extensions.ExtraAnalyzers.CallAnalysis; /// -/// Recommends replacing legacy logging calls with R9 logging calls. +/// Recommends replacing legacy logging calls with code generator-based logging calls. /// internal sealed class LegacyLogging { diff --git a/src/Analyzers/Microsoft.Analyzers.Extra/CallAnalysis/Split.cs b/src/Analyzers/Microsoft.Analyzers.Extra/CallAnalysis/Split.cs index a5c42560e1e..526f69832c0 100644 --- a/src/Analyzers/Microsoft.Analyzers.Extra/CallAnalysis/Split.cs +++ b/src/Analyzers/Microsoft.Analyzers.Extra/CallAnalysis/Split.cs @@ -8,7 +8,7 @@ namespace Microsoft.Extensions.ExtraAnalyzers.CallAnalysis; /// -/// Recommends R9's string split functionality instead of String.Split. +/// Recommends allocation-free string split functionality instead of String.Split. /// internal sealed class Split { diff --git a/src/Analyzers/Microsoft.Analyzers.Extra/DiagDescriptors.cs b/src/Analyzers/Microsoft.Analyzers.Extra/DiagDescriptors.cs index 05693ffc75e..6b0abf4923e 100644 --- a/src/Analyzers/Microsoft.Analyzers.Extra/DiagDescriptors.cs +++ b/src/Analyzers/Microsoft.Analyzers.Extra/DiagDescriptors.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System; using Microsoft.CodeAnalysis; [assembly: System.Resources.NeutralResourcesLanguage("en-us")] @@ -9,197 +10,154 @@ namespace Microsoft.Extensions.ExtraAnalyzers; internal static class DiagDescriptors { - /// - /// Category for analyzers that will improve performance of the application. - /// private const string Performance = nameof(Performance); - - /// - /// Category for analyzers that will make code more readable. - /// - private const string Readability = nameof(Readability); - - /// - /// Category for analyzers that will improve reliability of the application. - /// private const string Reliability = nameof(Reliability); - - /// - /// Category for analyzers that will improve resiliency of the application. - /// private const string Resilience = nameof(Resilience); - - /// - /// Category for analyzers that will make code more correct. - /// private const string Correctness = nameof(Correctness); - /// - /// Category for analyzers that will improve the privacy posture of code. - /// - private const string Privacy = nameof(Privacy); - - public static DiagnosticDescriptor LegacyLogging { get; } = new( - id: "R9A000", + public static DiagnosticDescriptor LegacyLogging { get; } = Make( + id: "EA0000", messageFormat: Resources.LegacyLoggingMessage, title: Resources.LegacyLoggingTitle, category: Performance, description: Resources.LegacyLoggingDescription, - defaultSeverity: DiagnosticSeverity.Warning, - helpLinkUri: "https://TODO/r9a000", - isEnabledByDefault: true); - - // R9A001..R9A020 are retired + defaultSeverity: DiagnosticSeverity.Warning); - public static DiagnosticDescriptor UsingToStringInLoggers { get; } = new( - id: "R9A021", + public static DiagnosticDescriptor UsingToStringInLoggers { get; } = Make( + id: "EA0001", messageFormat: Resources.UsingToStringInLoggersMessage, title: Resources.UsingToStringInLoggersTitle, - category: "Performance", + category: Performance, description: Resources.UsingToStringInLoggersDescription, - defaultSeverity: DiagnosticSeverity.Warning, - helpLinkUri: "https://TODO/r9a021", - isEnabledByDefault: true); + defaultSeverity: DiagnosticSeverity.Warning); - public static DiagnosticDescriptor StaticTime { get; } = new( - id: "R9A022", + public static DiagnosticDescriptor StaticTime { get; } = Make( + id: "EA0002", messageFormat: Resources.StaticTimeMessage, title: Resources.StaticTimeTitle, category: Reliability, description: Resources.StaticTimeDescription, - defaultSeverity: DiagnosticSeverity.Warning, - helpLinkUri: "https://TODO/r9a022", - isEnabledByDefault: true); + defaultSeverity: DiagnosticSeverity.Warning); - // R9A023..R9A029 retired - - public static DiagnosticDescriptor StartsEndsWith { get; } = new( - id: "R9A030", + public static DiagnosticDescriptor StartsEndsWith { get; } = Make( + id: "EA0003", messageFormat: Resources.StartsEndsWithMessage, title: Resources.StartsEndsWithTitle, category: Performance, description: Resources.StartsEndsWithDescription, - defaultSeverity: DiagnosticSeverity.Warning, - helpLinkUri: "https://TODO/r9a030", - isEnabledByDefault: true); + defaultSeverity: DiagnosticSeverity.Warning); - public static DiagnosticDescriptor MakeExeTypesInternal { get; } = new( - id: "R9A031", + public static DiagnosticDescriptor MakeExeTypesInternal { get; } = Make( + id: "EA0004", messageFormat: Resources.MakeExeTypesInternalMessage, title: Resources.MakeExeTypesInternalTitle, category: Performance, description: Resources.MakeExeTypesInternalDescription, - defaultSeverity: DiagnosticSeverity.Warning, - helpLinkUri: "https://TODO/r9a031", - isEnabledByDefault: true); + defaultSeverity: DiagnosticSeverity.Warning); - public static DiagnosticDescriptor Arrays { get; } = new( - id: "R9A032", + public static DiagnosticDescriptor Arrays { get; } = Make( + id: "EA0005", messageFormat: Resources.ArraysMessage, title: Resources.ArraysTitle, category: Performance, description: Resources.ArraysDescription, - defaultSeverity: DiagnosticSeverity.Warning, - helpLinkUri: "https://TODO/r9a032", - isEnabledByDefault: true); + defaultSeverity: DiagnosticSeverity.Warning); - public static DiagnosticDescriptor EnumStrings { get; } = new( - id: "R9A033", + public static DiagnosticDescriptor EnumStrings { get; } = Make( + id: "EA0006", messageFormat: Resources.EnumStringsMessage, title: Resources.EnumStringsTitle, category: Performance, description: Resources.EnumStringsDescription, - defaultSeverity: DiagnosticSeverity.Warning, - helpLinkUri: "https://TODO/r9a033", - isEnabledByDefault: true); - - // R9A034..R9A036 retired + defaultSeverity: DiagnosticSeverity.Warning); - public static DiagnosticDescriptor ValueTuple { get; } = new( - id: "R9A037", + public static DiagnosticDescriptor ValueTuple { get; } = Make( + id: "EA0007", messageFormat: Resources.ValueTupleMessage, title: Resources.ValueTupleTitle, category: Performance, description: Resources.ValueTupleDescription, - defaultSeverity: DiagnosticSeverity.Warning, - helpLinkUri: "https://TODO/r9a037", - isEnabledByDefault: true); - - // R9A038..R9A039 retired + defaultSeverity: DiagnosticSeverity.Warning); - public static DiagnosticDescriptor LegacyCollection { get; } = new( - id: "R9A040", + public static DiagnosticDescriptor LegacyCollection { get; } = Make( + id: "EA0008", messageFormat: Resources.LegacyCollectionMessage, title: Resources.LegacyCollectionTitle, category: Performance, description: Resources.LegacyCollectionDescription, - defaultSeverity: DiagnosticSeverity.Warning, - helpLinkUri: "https://TODO/r9a040", - isEnabledByDefault: true); + defaultSeverity: DiagnosticSeverity.Warning); - // R9A041..R9A042 retired - - public static DiagnosticDescriptor Split { get; } = new( - id: "R9A043", + public static DiagnosticDescriptor Split { get; } = Make( + id: "EA0009", messageFormat: Resources.SplitMessage, title: Resources.SplitTitle, category: Performance, description: Resources.SplitDescription, - defaultSeverity: DiagnosticSeverity.Warning, - helpLinkUri: "https://TODO/r9a043", - isEnabledByDefault: true); - - // R9A044..R9A055 retired + defaultSeverity: DiagnosticSeverity.Warning); - public static DiagnosticDescriptor AsyncCallInsideUsingBlock { get; } = new( - id: "R9A056", + public static DiagnosticDescriptor AsyncCallInsideUsingBlock { get; } = Make( + id: "EA0010", messageFormat: Resources.AsyncCallInsideUsingBlockMessage, title: Resources.AsyncCallInsideUsingBlockTitle, category: Correctness, description: Resources.AsyncCallInsideUsingBlockDescription, - defaultSeverity: DiagnosticSeverity.Warning, - helpLinkUri: "https://TODO/r9a056", - isEnabledByDefault: true); - - // R9A057 retired + defaultSeverity: DiagnosticSeverity.Warning); - public static DiagnosticDescriptor ConditionalAccess { get; } = new( - id: "R9A058", + public static DiagnosticDescriptor ConditionalAccess { get; } = Make( + id: "EA0011", messageFormat: Resources.ConditionalAccessMessage, title: Resources.ConditionalAccessTitle, category: Performance, description: Resources.ConditionalAccessDescription, - defaultSeverity: DiagnosticSeverity.Warning, - helpLinkUri: "https://TODO/r9a058", - isEnabledByDefault: true); + defaultSeverity: DiagnosticSeverity.Warning); - public static DiagnosticDescriptor CoalesceAssignment { get; } = new( - id: "R9A059", + public static DiagnosticDescriptor CoalesceAssignment { get; } = Make( + id: "EA0012", messageFormat: Resources.CoalesceAssignmentMessage, title: Resources.CoalesceAssignmentTitle, category: Performance, description: Resources.CoalesceAssignmentDescription, - defaultSeverity: DiagnosticSeverity.Warning, - helpLinkUri: "https://TODO/r9a059", - isEnabledByDefault: true); + defaultSeverity: DiagnosticSeverity.Warning); - public static DiagnosticDescriptor Coalesce { get; } = new( - id: "R9A060", + public static DiagnosticDescriptor Coalesce { get; } = Make( + id: "EA0013", messageFormat: Resources.CoalesceMessage, title: Resources.CoalesceTitle, category: Performance, description: Resources.CoalesceDescription, - defaultSeverity: DiagnosticSeverity.Warning, - helpLinkUri: "https://TODO/r9a060", - isEnabledByDefault: true); + defaultSeverity: DiagnosticSeverity.Warning); - public static DiagnosticDescriptor AsyncMethodWithoutCancellation { get; } = new( - id: "R9A061", + public static DiagnosticDescriptor AsyncMethodWithoutCancellation { get; } = Make( + id: "EA0014", messageFormat: Resources.AsyncMethodWithoutCancellationMessage, title: Resources.AsyncMethodWithoutCancellationTitle, category: Resilience, description: Resources.AsyncMethodWithoutCancellationDescription, - defaultSeverity: DiagnosticSeverity.Warning, - helpLinkUri: "https://TODO/r9a061", - isEnabledByDefault: true); + defaultSeverity: DiagnosticSeverity.Warning); + +#if false +#pragma warning disable S1075 // URIs should not be hardcoded + private const string HelpLinkBase = "https://TODO/"; +#pragma warning restore S1075 // URIs should not be hardcoded +#endif + + private static DiagnosticDescriptor Make(string id, string title, string description, string messageFormat, string category, DiagnosticSeverity defaultSeverity) + { + return new( + id, + title, + messageFormat, + category, + defaultSeverity, + true, +#if false + description, +#pragma warning disable CA1308 // Normalize strings to uppercase + HelpLinkBase + id.ToLowerInvariant(), +#pragma warning restore CA1308 // Normalize strings to uppercase + Array.Empty()); +#else + description); +#endif + } } diff --git a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/TextScanner.cs b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/TextScanner.cs index 5fa5b946d26..20e4beb946e 100644 --- a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/TextScanner.cs +++ b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/TextScanner.cs @@ -6,8 +6,6 @@ using System.Globalization; using System.IO; -#pragma warning disable R9A018 - namespace Microsoft.Extensions.LocalAnalyzers.Json; /// diff --git a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Utils.cs b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Utils.cs index 3383216f514..a92db86ee1f 100644 --- a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Utils.cs +++ b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Utils.cs @@ -5,8 +5,6 @@ using System.Collections.Generic; using System.Linq; -#pragma warning disable R9A043 - namespace Microsoft.Extensions.LocalAnalyzers.ApiLifecycle; internal static class Utils diff --git a/src/Analyzers/Microsoft.Analyzers.Local/CallAnalysis/CallAnalyzer.cs b/src/Analyzers/Microsoft.Analyzers.Local/CallAnalysis/CallAnalyzer.cs index e250a651c63..4d5f3fe1430 100644 --- a/src/Analyzers/Microsoft.Analyzers.Local/CallAnalysis/CallAnalyzer.cs +++ b/src/Analyzers/Microsoft.Analyzers.Local/CallAnalysis/CallAnalyzer.cs @@ -33,12 +33,10 @@ public override void Initialize(AnalysisContext context) _ = new Throws(reg); var handlers = new Handlers(state); -#pragma warning disable R9A044 compilationStartContext.RegisterOperationAction(handlers.HandleInvocation, OperationKind.Invocation); compilationStartContext.RegisterOperationAction(handlers.HandleObjectCreation, OperationKind.ObjectCreation); compilationStartContext.RegisterOperationAction(handlers.HandlePropertyReference, OperationKind.PropertyReference); compilationStartContext.RegisterOperationAction(handlers.HandleThrow, OperationKind.Throw); -#pragma warning restore R9A044 }); } } diff --git a/src/Analyzers/Microsoft.Analyzers.Local/CallAnalysis/Throws.cs b/src/Analyzers/Microsoft.Analyzers.Local/CallAnalysis/Throws.cs index de8afcea1e4..d5f2ed0353e 100644 --- a/src/Analyzers/Microsoft.Analyzers.Local/CallAnalysis/Throws.cs +++ b/src/Analyzers/Microsoft.Analyzers.Local/CallAnalysis/Throws.cs @@ -10,7 +10,7 @@ namespace Microsoft.Extensions.LocalAnalyzers.CallAnalysis; /// -/// Recommends using R9's Throws class. +/// Recommends using Throw helpers. /// internal sealed class Throws { @@ -19,13 +19,6 @@ internal sealed class Throws "System.ArgumentException", "System.ArgumentNullException", "System.ArgumentOutOfRangeException", - - // temporarily disabled in order to roll out analyzer updates without changing - // the rest of the source base. I'll start enabling the new analyzers and fixing - // all the warnings in subsequent prs. -#if TURNED_OFF_FOR_ANALYZER_ROLLOUT - "System.InvalidOperationException", -#endif }; public Throws(CallAnalyzer.Registrar reg) diff --git a/src/Analyzers/Microsoft.Analyzers.Local/CallAnalysis/ToInvariantString.cs b/src/Analyzers/Microsoft.Analyzers.Local/CallAnalysis/ToInvariantString.cs index 2070c508f34..c33a203f19f 100644 --- a/src/Analyzers/Microsoft.Analyzers.Local/CallAnalysis/ToInvariantString.cs +++ b/src/Analyzers/Microsoft.Analyzers.Local/CallAnalysis/ToInvariantString.cs @@ -9,7 +9,7 @@ namespace Microsoft.Extensions.LocalAnalyzers.CallAnalysis; /// -/// Recommends using R9's ToInvariantString extension method. +/// Recommends using the shared ToInvariantString extension method. /// internal sealed class ToInvariantString { diff --git a/src/Analyzers/Microsoft.Analyzers.Local/DiagDescriptors.cs b/src/Analyzers/Microsoft.Analyzers.Local/DiagDescriptors.cs index f3b015823b2..b99bf81abaf 100644 --- a/src/Analyzers/Microsoft.Analyzers.Local/DiagDescriptors.cs +++ b/src/Analyzers/Microsoft.Analyzers.Local/DiagDescriptors.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System; using Microsoft.CodeAnalysis; [assembly: System.Resources.NeutralResourcesLanguage("en-us")] @@ -39,84 +40,70 @@ internal static class DiagDescriptors /// private const string Privacy = nameof(Privacy); - public static DiagnosticDescriptor ThrowsExpression { get; } = new( - id: "R9A014", + public static DiagnosticDescriptor ThrowsExpression { get; } = Make( + id: "LA0000", messageFormat: Resources.ThrowsExpressionMessage, title: Resources.ThrowsExpressionTitle, category: Performance, description: Resources.ThrowsExpressionDescription, - defaultSeverity: DiagnosticSeverity.Warning, - helpLinkUri: "https://TODO/r9a014", - isEnabledByDefault: true); + defaultSeverity: DiagnosticSeverity.Warning); - public static DiagnosticDescriptor ThrowsStatement { get; } = new( - id: "R9A015", + public static DiagnosticDescriptor ThrowsStatement { get; } = Make( + id: "LA0001", messageFormat: Resources.ThrowsStatementMessage, title: Resources.ThrowsStatementTitle, category: Performance, description: Resources.ThrowsStatementDescription, - defaultSeverity: DiagnosticSeverity.Warning, - helpLinkUri: "https://TODO/r9a015", - isEnabledByDefault: true); + defaultSeverity: DiagnosticSeverity.Warning); - public static DiagnosticDescriptor ToInvariantString { get; } = new( - id: "R9A036", + public static DiagnosticDescriptor ToInvariantString { get; } = Make( + id: "LA0002", messageFormat: Resources.ToInvariantStringMessage, title: Resources.ToInvariantStringTitle, category: Performance, description: Resources.ToInvariantStringDescription, - defaultSeverity: DiagnosticSeverity.Warning, - helpLinkUri: "https://TODO/r9a036", - isEnabledByDefault: true); + defaultSeverity: DiagnosticSeverity.Warning); - public static DiagnosticDescriptor NewSymbolsMustBeMarkedExperimental { get; } = new( - id: "R9A049", + public static DiagnosticDescriptor NewSymbolsMustBeMarkedExperimental { get; } = Make( + id: "LA0003", messageFormat: Resources.NewSymbolsMustBeMarkedExperimentalMessage, title: Resources.NewSymbolsMustBeMarkedExperimentalTitle, category: Correctness, description: Resources.NewSymbolsMustBeMarkedExperimentalDescription, - defaultSeverity: DiagnosticSeverity.Hidden, - helpLinkUri: "https://TODO/r9a049", - isEnabledByDefault: true); + defaultSeverity: DiagnosticSeverity.Warning); - public static DiagnosticDescriptor ExperimentalSymbolsCantBeMarkedObsolete { get; } = new( - id: "R9A050", + public static DiagnosticDescriptor ExperimentalSymbolsCantBeMarkedObsolete { get; } = Make( + id: "LA0004", messageFormat: Resources.ExperimentalSymbolsCantBeMarkedObsoleteMessage, title: Resources.ExperimentalSymbolsCantBeMarkedObsoleteTitle, category: Correctness, description: Resources.ExperimentalSymbolsCantBeMarkedObsoleteDescription, - defaultSeverity: DiagnosticSeverity.Hidden, - helpLinkUri: "https://TODO/r9a050", - isEnabledByDefault: true); + defaultSeverity: DiagnosticSeverity.Warning); - public static DiagnosticDescriptor PublishedSymbolsCantBeMarkedExperimental { get; } = new( - id: "R9A051", + public static DiagnosticDescriptor PublishedSymbolsCantBeMarkedExperimental { get; } = Make( + id: "LA0005", messageFormat: Resources.PublishedSymbolsCantBeMarkedExperimentalMessage, title: Resources.PublishedSymbolsCantBeMarkedExperimentalTitle, category: Correctness, description: Resources.PublishedSymbolsCantBeMarkedExperimentalDescription, - defaultSeverity: DiagnosticSeverity.Hidden, - helpLinkUri: "https://TODO/r9a051", - isEnabledByDefault: true); + defaultSeverity: DiagnosticSeverity.Warning); - public static DiagnosticDescriptor PublishedSymbolsCantBeDeleted { get; } = new( - id: "R9A052", + public static DiagnosticDescriptor PublishedSymbolsCantBeDeleted { get; } = Make( + id: "LA0006", messageFormat: Resources.PublishedSymbolsCantBeDeletedMessage, title: Resources.PublishedSymbolsCantBeDeletedTitle, category: Correctness, description: Resources.PublishedSymbolsCantBeDeletedDescription, - defaultSeverity: DiagnosticSeverity.Hidden, - helpLinkUri: "https://TODO/r9a052", - isEnabledByDefault: true); + defaultSeverity: DiagnosticSeverity.Warning); - public static DiagnosticDescriptor PublishedSymbolsCantChange { get; } = new( - id: "R9A055", + public static DiagnosticDescriptor PublishedSymbolsCantChange { get; } = Make( + id: "LA0007", messageFormat: Resources.PublishedSymbolsCantChangeMessage, title: Resources.PublishedSymbolsCantChangedTitle, category: Correctness, description: Resources.PublishedSymbolsCantChangeDescription, - defaultSeverity: DiagnosticSeverity.Hidden, - helpLinkUri: "https://TODO/r9a055", - isEnabledByDefault: true); + defaultSeverity: DiagnosticSeverity.Warning); + private static DiagnosticDescriptor Make(string id, string title, string description, string messageFormat, string category, DiagnosticSeverity defaultSeverity) + => new(id, title, messageFormat, category, defaultSeverity, true, description); } diff --git a/src/Generators/.editorconfig b/src/Generators/.editorconfig index be5b3fa69ab..b264953e5ea 100644 --- a/src/Generators/.editorconfig +++ b/src/Generators/.editorconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:50Z +# Generated : 2023-08-07 17:59:51Z # Max Tier : 2147483647 # Attributes: general, performance, production -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers [*.cs] @@ -104,6 +104,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = warning +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = warning + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -474,6 +479,11 @@ dotnet_diagnostic.CA1507.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 dotnet_diagnostic.CA1508.severity = warning +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Invalid entry in code metrics rule specification file # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509 @@ -791,7 +801,7 @@ dotnet_diagnostic.CA1847.severity = warning # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use R9 logging model instead +# Comment : Use the code generated model instead. dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -812,7 +822,6 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -# Redundant: R9A013 dotnet_diagnostic.CA1852.severity = none # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' @@ -843,23 +852,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = warning # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = warning # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = warning + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = warning + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = warning + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = warning + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1175,6 +1219,11 @@ dotnet_diagnostic.CA2259.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = warning +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1670,6 +1719,66 @@ dotnet_diagnostic.CA5404.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = warning +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = warning + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = warning + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = warning + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = warning + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = warning + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = warning + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = warning + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = warning + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = warning + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = warning + # Title : Set MSBuild property 'GenerateDocumentationFile' to 'true' # Category : Style # Help Link: https://github.com/dotnet/roslyn/issues/41640 @@ -1968,7 +2077,7 @@ dotnet_diagnostic.IDE0051.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0052 dotnet_diagnostic.IDE0052.severity = warning -# Title : Use block body for lambda expression +# Title : Use expression body for lambda expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0053 # Comment : This metadata was entered manually, since it is not exposed in the normal way from the analyzer assembly. @@ -2107,7 +2216,7 @@ dotnet_style_prefer_simplified_interpolation = true # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0072 dotnet_diagnostic.IDE0072.severity = silent -# Title : The file header does not match the required text +# Title : The file header is missing or not located at the top of the file # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0073 dotnet_diagnostic.IDE0073.severity = warning @@ -2286,6 +2395,21 @@ dotnet_diagnostic.IDE0270.severity = silent # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0280 dotnet_diagnostic.IDE0280.severity = silent +# Title : Use primary constructor +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0290 +dotnet_diagnostic.IDE0290.severity = none + +# Title : Simplify collection initialization +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0300 +dotnet_diagnostic.IDE0300.severity = none + +# Title : Simplify collection initialization +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0301 +dotnet_diagnostic.IDE0301.severity = suggestion + # Title : Delegate invocation can be simplified. # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1005 @@ -2587,7 +2711,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = warning @@ -2669,155 +2793,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = warning - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = warning +dotnet_diagnostic.LA0000.severity = warning # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = warning - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = warning - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = warning - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = warning - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = warning - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = warning - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = none - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = warning - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = warning - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = warning +dotnet_diagnostic.LA0001.severity = warning # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = warning - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = warning - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = warning - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = warning - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = warning +dotnet_diagnostic.LA0002.severity = warning # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = none +dotnet_diagnostic.LA0003.severity = none # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = none +dotnet_diagnostic.LA0004.severity = none # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = none +dotnet_diagnostic.LA0005.severity = none # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = none - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = none - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = none +dotnet_diagnostic.LA0006.severity = none # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = none - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = warning +dotnet_diagnostic.LA0007.severity = none # Title : # Category : Style @@ -3597,7 +3603,8 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3906,7 +3913,7 @@ dotnet_diagnostic.S3257.severity = warning # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: R9A013 +# Redundant: CA1852 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4870,7 +4877,7 @@ dotnet_diagnostic.S5773.severity = warning # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Generators/Microsoft.Gen.AutoClient/DiagDescriptors.cs b/src/Generators/Microsoft.Gen.AutoClient/DiagDescriptors.cs index 63ad04937a9..cc2ed4d8100 100644 --- a/src/Generators/Microsoft.Gen.AutoClient/DiagDescriptors.cs +++ b/src/Generators/Microsoft.Gen.AutoClient/DiagDescriptors.cs @@ -11,136 +11,134 @@ internal sealed class DiagDescriptors : DiagDescriptorsBase private const string Category = "Design"; public static DiagnosticDescriptor ErrorClientMustNotBeNested { get; } = Make( - id: "R9G301", + id: "AUTOCLIENTGEN001", title: Resources.ErrorClientMustNotBeNestedTitle, messageFormat: Resources.ErrorClientMustNotBeNestedMessage, category: Category); public static DiagnosticDescriptor WarningRestClientWithoutRestMethods { get; } = Make( - id: "R9G302", + id: "AUTOCLIENTGEN002", title: Resources.WarningRestClientWithoutRestMethodsTitle, messageFormat: Resources.WarningRestClientWithoutRestMethodsMessage, category: Category, defaultSeverity: DiagnosticSeverity.Warning); public static DiagnosticDescriptor ErrorApiMethodMoreThanOneAttribute { get; } = Make( - id: "R9G303", + id: "AUTOCLIENTGEN003", title: Resources.ErrorApiMethodMoreThanOneAttributeTitle, messageFormat: Resources.ErrorApiMethodMoreThanOneAttributeMessage, category: Category); public static DiagnosticDescriptor ErrorInvalidReturnType { get; } = Make( - id: "R9G304", + id: "AUTOCLIENTGEN004", title: Resources.ErrorInvalidReturnTypeTitle, messageFormat: Resources.ErrorInvalidReturnTypeMessage, category: Category); public static DiagnosticDescriptor ErrorMethodIsGeneric { get; } = Make( - id: "R9G305", + id: "AUTOCLIENTGEN005", title: Resources.ErrorMethodIsGenericTitle, messageFormat: Resources.ErrorMethodIsGenericMessage, category: Category); public static DiagnosticDescriptor ErrorUnsupportedMethodBody { get; } = Make( - id: "R9G306", + id: "AUTOCLIENTGEN006", title: Resources.ErrorUnsupportedMethodBodyTitle, messageFormat: Resources.ErrorUnsupportedMethodBodyMessage, category: Category); public static DiagnosticDescriptor ErrorStaticMethod { get; } = Make( - id: "R9G307", + id: "AUTOCLIENTGEN007", title: Resources.ErrorStaticMethodTitle, messageFormat: Resources.ErrorStaticMethodMessage, category: Category); - // R9G308..R9G309 retired - public static DiagnosticDescriptor ErrorMissingMethodAttribute { get; } = Make( - id: "R9G310", + id: "AUTOCLIENTGEN008", title: Resources.ErrorMissingMethodAttributeTitle, messageFormat: Resources.ErrorMissingMethodAttributeMessage, category: Category); public static DiagnosticDescriptor ErrorInterfaceIsGeneric { get; } = Make( - id: "R9G311", + id: "AUTOCLIENTGEN009", title: Resources.ErrorInterfaceIsGenericTitle, messageFormat: Resources.ErrorInterfaceIsGenericMessage, category: Category); public static DiagnosticDescriptor ErrorInterfaceName { get; } = Make( - id: "R9G312", + id: "AUTOCLIENTGEN010", title: Resources.ErrorInterfaceNameTitle, messageFormat: Resources.ErrorInterfaceNameMessage, category: Category); public static DiagnosticDescriptor ErrorDuplicateBody { get; } = Make( - id: "R9G313", + id: "AUTOCLIENTGEN011", title: Resources.ErrorDuplicateBodyTitle, messageFormat: Resources.ErrorDuplicateBodyMessage, category: Category); public static DiagnosticDescriptor ErrorMissingParameterUrl { get; } = Make( - id: "R9G314", + id: "AUTOCLIENTGEN012", title: Resources.ErrorMissingParameterUrlTitle, messageFormat: Resources.ErrorMissingParameterUrlMessage, category: Category); public static DiagnosticDescriptor ErrorDuplicateCancellationToken { get; } = Make( - id: "R9G315", + id: "AUTOCLIENTGEN013", title: Resources.ErrorDuplicateCancellationTokenTitle, messageFormat: Resources.ErrorDuplicateCancellationTokenMessage, category: Category); public static DiagnosticDescriptor ErrorMissingCancellationToken { get; } = Make( - id: "R9G315", + id: "AUTOCLIENTGEN014", title: Resources.ErrorMissingCancellationTokenTitle, messageFormat: Resources.ErrorMissingCancellationTokenMessage, category: Category); public static DiagnosticDescriptor ErrorPathWithQuery { get; } = Make( - id: "R9G316", + id: "AUTOCLIENTGEN015", title: Resources.ErrorPathWithQueryTitle, messageFormat: Resources.ErrorPathWithQueryMessage, category: Category); public static DiagnosticDescriptor ErrorDuplicateRequestName { get; } = Make( - id: "R9G317", + id: "AUTOCLIENTGEN016", title: Resources.ErrorDuplicateRequestNameTitle, messageFormat: Resources.ErrorDuplicateRequestNameMessage, category: Category); public static DiagnosticDescriptor ErrorInvalidHttpClientName { get; } = Make( - id: "R9G318", + id: "AUTOCLIENTGEN017", title: Resources.ErrorInvalidHttpClientNameTitle, messageFormat: Resources.ErrorInvalidHttpClientNameMessage, category: Category); public static DiagnosticDescriptor ErrorInvalidDependencyName { get; } = Make( - id: "R9G319", + id: "AUTOCLIENTGEN018", title: Resources.ErrorInvalidDependencyNameTitle, messageFormat: Resources.ErrorInvalidDependencyNameMessage, category: Category); public static DiagnosticDescriptor ErrorInvalidHeaderName { get; } = Make( - id: "R9G320", + id: "AUTOCLIENTGEN019", title: Resources.ErrorInvalidHeaderNameTitle, messageFormat: Resources.ErrorInvalidHeaderNameMessage, category: Category); public static DiagnosticDescriptor ErrorInvalidHeaderValue { get; } = Make( - id: "R9G321", + id: "AUTOCLIENTGEN020", title: Resources.ErrorInvalidHeaderValueTitle, messageFormat: Resources.ErrorInvalidHeaderValueMessage, category: Category); public static DiagnosticDescriptor ErrorInvalidPath { get; } = Make( - id: "R9G322", + id: "AUTOCLIENTGEN021", title: Resources.ErrorInvalidPathTitle, messageFormat: Resources.ErrorInvalidPathMessage, category: Category); public static DiagnosticDescriptor ErrorInvalidRequestName { get; } = Make( - id: "R9G323", + id: "AUTOCLIENTGEN022", title: Resources.ErrorInvalidRequestNameTitle, messageFormat: Resources.ErrorInvalidRequestNameMessage, category: Category); diff --git a/src/Generators/Microsoft.Gen.ComplianceReports/ComplianceReportsGenerator.cs b/src/Generators/Microsoft.Gen.ComplianceReports/ComplianceReportsGenerator.cs index 1b12702fc0d..63f63aeab2d 100644 --- a/src/Generators/Microsoft.Gen.ComplianceReports/ComplianceReportsGenerator.cs +++ b/src/Generators/Microsoft.Gen.ComplianceReports/ComplianceReportsGenerator.cs @@ -88,11 +88,9 @@ public void Execute(GeneratorExecutionContext context) } } -#pragma warning disable R9A017 // Switch to an asynchronous method for increased performance. _ = Directory.CreateDirectory(_directory); // Write report as JSON file. File.WriteAllText(Path.Combine(_directory, _fileName), report); -#pragma warning restore R9A017 // Switch to an asynchronous method for increased performance. } } diff --git a/src/Generators/Microsoft.Gen.ComplianceReports/Emitter.cs b/src/Generators/Microsoft.Gen.ComplianceReports/Emitter.cs index 094d1c59686..56faf90a764 100644 --- a/src/Generators/Microsoft.Gen.ComplianceReports/Emitter.cs +++ b/src/Generators/Microsoft.Gen.ComplianceReports/Emitter.cs @@ -20,7 +20,7 @@ public Emitter() { } - [SuppressMessage("Performance", "R9A036:Use 'Microsoft.Extensions.Text.NumericExtensions.ToInvariantString' for improved performance", Justification = "Can't use that in a generator")] + [SuppressMessage("Performance", "LA0002:Use 'Microsoft.Extensions.Text.NumericExtensions.ToInvariantString' for improved performance", Justification = "Can't use that in a generator")] public string Emit(IReadOnlyCollection classifiedTypes, string assemblyName) { OutObject(() => diff --git a/src/Generators/Microsoft.Gen.ContextualOptions/DiagDescriptors.cs b/src/Generators/Microsoft.Gen.ContextualOptions/DiagDescriptors.cs index 0749e17159f..d4ebf8d2095 100644 --- a/src/Generators/Microsoft.Gen.ContextualOptions/DiagDescriptors.cs +++ b/src/Generators/Microsoft.Gen.ContextualOptions/DiagDescriptors.cs @@ -11,26 +11,26 @@ internal sealed class DiagDescriptors : DiagDescriptorsBase private const string Category = "ContextualOptions"; public static DiagnosticDescriptor ContextCannotBeStatic { get; } = Make( - id: "R9G200", + id: "CTXOPTGEN000", title: Resources.ContextCannotBeStaticTitle, messageFormat: Resources.ContextCannotBeStaticMessage, category: Category); public static DiagnosticDescriptor ContextMustBePartial { get; } = Make( - id: "R9G201", + id: "CTXOPTGEN001", title: Resources.ContextMustBePartialTitle, messageFormat: Resources.ContextMustBePartialMessage, category: Category); public static DiagnosticDescriptor ContextDoesNotHaveValidProperties { get; } = Make( - id: "R9G202", + id: "CTXOPTGEN002", title: Resources.ContextDoesNotHaveValidPropertiesTitle, messageFormat: Resources.ContextDoesNotHaveValidPropertiesMessage, category: Category, defaultSeverity: DiagnosticSeverity.Warning); public static DiagnosticDescriptor ContextCannotBeRefLike { get; } = Make( - id: "R9G203", + id: "CTXOPTGEN003", title: Resources.ContextCannotBeRefLikeTitle, messageFormat: Resources.ContextCannotBeRefLikeMessage, category: Category); diff --git a/src/Generators/Microsoft.Gen.EnumStrings/DiagDescriptors.cs b/src/Generators/Microsoft.Gen.EnumStrings/DiagDescriptors.cs index e0ecd54cb19..9d4c5d7db9d 100644 --- a/src/Generators/Microsoft.Gen.EnumStrings/DiagDescriptors.cs +++ b/src/Generators/Microsoft.Gen.EnumStrings/DiagDescriptors.cs @@ -11,31 +11,31 @@ internal sealed class DiagDescriptors : DiagDescriptorsBase private const string Category = "EnumStrings"; public static DiagnosticDescriptor InvalidExtensionNamespace { get; } = Make( - id: "R9G250", + id: "ENUMSTRGEN000", title: Resources.InvalidExtensionNamespaceTitle, messageFormat: Resources.InvalidExtensionNamespaceMessage, category: Category); public static DiagnosticDescriptor IncorrectOverload { get; } = Make( - id: "R9G251", + id: "ENUMSTRGEN001", title: Resources.IncorrectOverloadTitle, messageFormat: Resources.IncorrectOverloadMessage, category: Category); public static DiagnosticDescriptor InvalidExtensionClassName { get; } = Make( - id: "R9G252", + id: "ENUMSTRGEN002", title: Resources.InvalidExtensionClassNameTitle, messageFormat: Resources.InvalidExtensionClassNameMessage, category: Category); public static DiagnosticDescriptor InvalidExtensionMethodName { get; } = Make( - id: "R9G253", + id: "ENUMSTRGEN003", title: Resources.InvalidExtensionMethodNameTitle, messageFormat: Resources.InvalidExtensionMethodNameMessage, category: Category); public static DiagnosticDescriptor InvalidEnumType { get; } = Make( - id: "R9G254", + id: "ENUMSTRGEN004", title: Resources.InvalidEnumTypeTitle, messageFormat: Resources.InvalidEnumTypeMessage, category: Category); diff --git a/src/Generators/Microsoft.Gen.EnumStrings/Emitter.cs b/src/Generators/Microsoft.Gen.EnumStrings/Emitter.cs index e0aa6c1cf7f..34b51de7676 100644 --- a/src/Generators/Microsoft.Gen.EnumStrings/Emitter.cs +++ b/src/Generators/Microsoft.Gen.EnumStrings/Emitter.cs @@ -11,7 +11,7 @@ namespace Microsoft.Gen.EnumStrings; -#pragma warning disable R9A036 // Use 'Microsoft.Extensions.Text.NumericExtensions.ToInvariantString' for improved performance +#pragma warning disable LA0002 // Use 'Microsoft.Extensions.Text.NumericExtensions.ToInvariantString' for improved performance #pragma warning disable S109 // Magic numbers should not be used // Stryker disable all diff --git a/src/Generators/Microsoft.Gen.Logging/Parsing/DiagDescriptors.cs b/src/Generators/Microsoft.Gen.Logging/Parsing/DiagDescriptors.cs index b11f6be95d7..75cf996efb9 100644 --- a/src/Generators/Microsoft.Gen.Logging/Parsing/DiagDescriptors.cs +++ b/src/Generators/Microsoft.Gen.Logging/Parsing/DiagDescriptors.cs @@ -10,223 +10,205 @@ internal sealed class DiagDescriptors : DiagDescriptorsBase { private const string Category = "LogMethod"; - // R9G000 retired - public static DiagnosticDescriptor ShouldntMentionLogLevelInMessage { get; } = Make( - id: "R9G001", + id: "LOGGEN000", title: Resources.ShouldntMentionLogLevelInMessageTitle, messageFormat: Resources.ShouldntMentionLogLevelInMessageMessage, category: Category, DiagnosticSeverity.Warning); - // R9G002,R9G003 retired - public static DiagnosticDescriptor MissingRequiredType { get; } = Make( - id: "R9G004", + id: "LOGGEN001", title: Resources.MissingRequiredTypeTitle, messageFormat: Resources.MissingRequiredTypeMessage, category: Category); public static DiagnosticDescriptor ShouldntReuseEventIds { get; } = Make( - id: "R9G005", + id: "LOGGEN002", title: Resources.ShouldntReuseEventIdsTitle, messageFormat: Resources.ShouldntReuseEventIdsMessage, category: Category, DiagnosticSeverity.Warning); public static DiagnosticDescriptor LoggingMethodMustReturnVoid { get; } = Make( - id: "R9G006", + id: "LOGGEN003", title: Resources.LoggingMethodMustReturnVoidTitle, messageFormat: Resources.LoggingMethodMustReturnVoidMessage, category: Category); public static DiagnosticDescriptor MissingLoggerParameter { get; } = Make( - id: "R9G007", + id: "LOGGEN004", title: Resources.MissingLoggerParameterTitle, messageFormat: Resources.MissingLoggerParameterMessage, category: Category); public static DiagnosticDescriptor LoggingMethodShouldBeStatic { get; } = Make( - id: "R9G008", + id: "LOGGEN005", title: Resources.LoggingMethodShouldBeStaticTitle, messageFormat: Resources.LoggingMethodShouldBeStaticMessage, category: Category, DiagnosticSeverity.Warning); public static DiagnosticDescriptor LoggingMethodMustBePartial { get; } = Make( - id: "R9G009", + id: "LOGGEN006", title: Resources.LoggingMethodMustBePartialTitle, messageFormat: Resources.LoggingMethodMustBePartialMessage, category: Category); public static DiagnosticDescriptor LoggingMethodIsGeneric { get; } = Make( - id: "R9G010", + id: "LOGGEN007", title: Resources.LoggingMethodIsGenericTitle, messageFormat: Resources.LoggingMethodIsGenericMessage, category: Category); public static DiagnosticDescriptor RedundantQualifierInMessage { get; } = Make( - id: "R9G011", + id: "LOGGEN008", title: Resources.RedundantQualifierInMessageTitle, messageFormat: Resources.RedundantQualifierInMessageMessage, category: Category, DiagnosticSeverity.Warning); public static DiagnosticDescriptor ShouldntMentionExceptionInMessage { get; } = Make( - id: "R9G012", + id: "LOGGEN009", title: Resources.ShouldntMentionExceptionInMessageTitle, messageFormat: Resources.ShouldntMentionExceptionInMessageMessage, category: Category, DiagnosticSeverity.Warning); public static DiagnosticDescriptor TemplateHasNoCorrespondingParameter { get; } = Make( - id: "R9G013", + id: "LOGGEN010", title: Resources.TemplateHasNoCorrespondingParameterTitle, messageFormat: Resources.TemplateHasNoCorrespondingParameterMessage, category: Category); public static DiagnosticDescriptor ParameterHasNoCorrespondingTemplate { get; } = Make( - id: "R9G014", + id: "LOGGEN011", title: Resources.ParameterHasNoCorrespondingTemplateTitle, messageFormat: Resources.ParameterHasNoCorrespondingTemplateMessage, category: Category, DiagnosticSeverity.Info); public static DiagnosticDescriptor LoggingMethodHasBody { get; } = Make( - id: "R9G015", + id: "LOGGEN012", title: Resources.LoggingMethodHasBodyTitle, messageFormat: Resources.LoggingMethodHasBodyMessage, category: Category); public static DiagnosticDescriptor MissingLogLevel { get; } = Make( - id: "R9G016", + id: "LOGGEN013", title: Resources.MissingLogLevelTitle, messageFormat: Resources.MissingLogLevelMessage, category: Category); public static DiagnosticDescriptor ShouldntMentionLoggerInMessage { get; } = Make( - id: "R9G017", + id: "LOGGEN014", title: Resources.ShouldntMentionLoggerInMessageTitle, messageFormat: Resources.ShouldntMentionLoggerInMessageMessage, category: Category, DiagnosticSeverity.Warning); public static DiagnosticDescriptor MissingLoggerField { get; } = Make( - id: "R9G018", + id: "LOGGEN015", title: Resources.MissingLoggerFieldTitle, messageFormat: Resources.MissingLoggerFieldMessage, category: Category); public static DiagnosticDescriptor MultipleLoggerFields { get; } = Make( - id: "R9G019", + id: "LOGGEN016", title: Resources.MultipleLoggerFieldsTitle, messageFormat: Resources.MultipleLoggerFieldsMessage, category: Category); public static DiagnosticDescriptor MultipleDataClassificationAttributes { get; } = Make( - id: "R9G020", + id: "LOGGEN017", title: Resources.MultipleDataClassificationAttributesTitle, messageFormat: Resources.MultipleDataClassificationAttributesMessage, category: Category); - // R9G021..R9G024 retired - public static DiagnosticDescriptor InvalidTypeToLogProperties { get; } = Make( - id: "R9G025", + id: "LOGGEN018", title: Resources.InvalidTypeToLogPropertiesTitle, messageFormat: Resources.InvalidTypeToLogPropertiesMessage, category: Category, DiagnosticSeverity.Warning); - // Skipping R9G026 - public static DiagnosticDescriptor LogPropertiesInvalidUsage { get; } = Make( - id: "R9G027", + id: "LOGGEN019", title: Resources.LogPropertiesInvalidUsageTitle, messageFormat: Resources.LogPropertiesInvalidUsageMessage, category: Category); public static DiagnosticDescriptor LogPropertiesParameterSkipped { get; } = Make( - id: "R9G028", + id: "LOGGEN020", title: Resources.LogPropertiesParameterSkippedTitle, messageFormat: Resources.LogPropertiesParameterSkippedMessage, category: Category, DiagnosticSeverity.Warning); public static DiagnosticDescriptor LogPropertiesCycleDetected { get; } = Make( - id: "R9G029", + id: "LOGGEN021", title: Resources.LogPropertiesCycleDetectedTitle, messageFormat: Resources.LogPropertiesCycleDetectedMessage, category: Category); - // Skipping R9G030 - // Skipping R9G031 - public static DiagnosticDescriptor TagProviderMethodNotFound { get; } = Make( - id: "R9G032", + id: "LOGGEN022", title: Resources.TagProviderMethodNotFoundTitle, messageFormat: Resources.TagProviderMethodNotFoundMessage, category: Category); - // Skipping R9G033 - public static DiagnosticDescriptor TagProviderMethodInaccessible { get; } = Make( - id: "R9G034", + id: "LOGGEN023", title: Resources.TagProviderMethodInaccessibleTitle, messageFormat: Resources.TagProviderMethodInaccessibleMessage, category: Category); public static DiagnosticDescriptor TagProviderMethodInvalidSignature { get; } = Make( - id: "R9G035", + id: "LOGGEN024", title: Resources.TagProviderMethodInvalidSignatureTitle, messageFormat: Resources.TagProviderMethodInvalidSignatureMessage, category: Category); - // Skipping R9G036 - // Skipping R9G037 - public static DiagnosticDescriptor LoggingMethodParameterRefKind { get; } = Make( - id: "R9G038", + id: "LOGGEN025", title: Resources.LoggingMethodParameterRefKindTitle, messageFormat: Resources.LoggingMethodParameterRefKindMessage, category: Category); public static DiagnosticDescriptor LogPropertiesProviderWithRedaction { get; } = Make( - id: "R9G039", + id: "LOGGEN026", title: Resources.TagProviderWithRedactionTitle, messageFormat: Resources.TagProviderWithRedactionMessage, category: Category, DiagnosticSeverity.Warning); public static DiagnosticDescriptor ShouldntReuseEventNames { get; } = Make( - id: "R9G040", + id: "LOGGEN027", title: Resources.ShouldntReuseEventNamesTitle, messageFormat: Resources.ShouldntReuseEventNamesMessage, category: Category, DiagnosticSeverity.Warning); - // R9G041 is no longer in use - public static DiagnosticDescriptor LogPropertiesHiddenPropertyDetected { get; } = Make( - id: "R9G042", + id: "LOGGEN028", title: Resources.LogPropertiesHiddenPropertyDetectedTitle, messageFormat: Resources.LogPropertiesHiddenPropertyDetectedMessage, category: Category); public static DiagnosticDescriptor LogPropertiesNameCollision { get; } = Make( - id: "R9G043", + id: "LOGGEN029", title: Resources.LogPropertiesNameCollisionTitle, messageFormat: Resources.LogPropertiesNameCollisionMessage, category: Category); public static DiagnosticDescriptor EmptyLoggingMethod { get; } = Make( - id: "R9G044", + id: "LOGGEN030", title: Resources.EmptyLoggingMethodTitle, messageFormat: Resources.EmptyLoggingMethodMessage, category: Category); public static DiagnosticDescriptor TemplateStartsWithAtSymbol { get; } = Make( - id: "R9G045", + id: "LOGGEN031", title: Resources.TemplateStartsWithAtSymbolTitle, messageFormat: Resources.TemplateStartsWithAtSymbolMessage, category: Category); diff --git a/src/Generators/Microsoft.Gen.Logging/Parsing/TemplateExtractor.cs b/src/Generators/Microsoft.Gen.Logging/Parsing/TemplateExtractor.cs index 11e1ecc731f..bd0015164b8 100644 --- a/src/Generators/Microsoft.Gen.Logging/Parsing/TemplateExtractor.cs +++ b/src/Generators/Microsoft.Gen.Logging/Parsing/TemplateExtractor.cs @@ -23,7 +23,9 @@ internal static void ExtractTemplates(string? message, IDictionary foundAtTemplates = null!; +#pragma warning disable CA1859 // Use concrete types when possible for improved performance + ICollection? foundAtTemplates = null; +#pragma warning restore CA1859 // Use concrete types when possible for improved performance while (scanIndex < endIndex) { var openBraceIndex = FindBraceIndex(message, '{', scanIndex, endIndex); diff --git a/src/Generators/Microsoft.Gen.Metering/DiagDescriptors.cs b/src/Generators/Microsoft.Gen.Metering/DiagDescriptors.cs index a1a3aec6371..fefca3a2451 100644 --- a/src/Generators/Microsoft.Gen.Metering/DiagDescriptors.cs +++ b/src/Generators/Microsoft.Gen.Metering/DiagDescriptors.cs @@ -11,123 +11,121 @@ internal sealed class DiagDescriptors : DiagDescriptorsBase private const string Category = "Metering"; public static DiagnosticDescriptor ErrorInvalidMethodName { get; } = Make( - id: "R9G050", + id: "METGEN000", title: Resources.ErrorInvalidMethodNameTitle, messageFormat: Resources.ErrorInvalidMethodNameMessage, category: Category); public static DiagnosticDescriptor ErrorInvalidParameterName { get; } = Make( - id: "R9G051", + id: "METGEN001", title: Resources.ErrorInvalidParameterNameTitle, messageFormat: Resources.ErrorInvalidParameterNameMessage, category: Category); - // R9G052 is not in use, but can be referenced by the old Metric generator - public static DiagnosticDescriptor ErrorInvalidMetricName { get; } = Make( - id: "R9G053", + id: "METGEN002", title: Resources.ErrorInvalidMetricNameTitle, messageFormat: Resources.ErrorInvalidMetricNameMessage, category: Category); public static DiagnosticDescriptor ErrorMetricNameReuse { get; } = Make( - id: "R9G054", + id: "METGEN003", title: Resources.ErrorMetricNameReuseTitle, messageFormat: Resources.ErrorMetricNameReuseMessage, category: Category); public static DiagnosticDescriptor ErrorInvalidMethodReturnType { get; } = Make( - id: "R9G055", + id: "METGEN004", title: Resources.ErrorInvalidMethodReturnTypeTitle, messageFormat: Resources.ErrorInvalidMethodReturnTypeMessage, category: Category); public static DiagnosticDescriptor ErrorMissingMeter { get; } = Make( - id: "R9G056", + id: "METGEN005", title: Resources.ErrorMissingMeterTitle, messageFormat: Resources.ErrorMissingMeterMessage, category: Category); public static DiagnosticDescriptor ErrorNotPartialMethod { get; } = Make( - id: "R9G057", + id: "METGEN006", title: Resources.ErrorNotPartialMethodTitle, messageFormat: Resources.ErrorNotPartialMethodMessage, category: Category); public static DiagnosticDescriptor ErrorMethodIsGeneric { get; } = Make( - id: "R9G058", + id: "METGEN007", title: Resources.ErrorMethodIsGenericTitle, messageFormat: Resources.ErrorMethodIsGenericMessage, category: Category); public static DiagnosticDescriptor ErrorMethodHasBody { get; } = Make( - id: "R9G059", + id: "METGEN008", title: Resources.ErrorMethodHasBodyTitle, messageFormat: Resources.ErrorMethodHasBodyMessage, category: Category); public static DiagnosticDescriptor ErrorInvalidTagNames { get; } = Make( - id: "R9G060", + id: "METGEN009", title: Resources.ErrorInvalidTagNamesMessage, messageFormat: Resources.ErrorInvalidTagNamesTitle, category: Category); public static DiagnosticDescriptor ErrorNotStaticMethod { get; } = Make( - id: "R9G062", + id: "METGEN010", title: Resources.ErrorNotStaticMethodTitle, messageFormat: Resources.ErrorNotStaticMethodMessage, category: Category); public static DiagnosticDescriptor ErrorDuplicateTagName { get; } = Make( - id: "R9G063", + id: "METGEN011", title: Resources.ErrorDuplicateTagNameTitle, messageFormat: Resources.ErrorDuplicateTagNameMessage, category: Category); public static DiagnosticDescriptor ErrorInvalidTagNameType { get; } = Make( - id: "R9G064", + id: "METGEN012", title: Resources.ErrorInvalidTagTypeTitle, messageFormat: Resources.ErrorInvalidTagTypeMessage, category: Category); public static DiagnosticDescriptor ErrorTooManyTagNames { get; } = Make( - id: "R9G065", + id: "METGEN013", title: Resources.ErrorTooManyTagNamesTitle, messageFormat: Resources.ErrorTooManyTagNamesMessage, category: Category); public static DiagnosticDescriptor ErrorInvalidAttributeGenericType { get; } = Make( - id: "R9G066", + id: "METGEN014", title: Resources.ErrorInvalidAttributeGenericTypeTitle, messageFormat: Resources.ErrorInvalidAttributeGenericTypeMessage, category: Category); public static DiagnosticDescriptor ErrorInvalidMethodReturnTypeLocation { get; } = Make( - id: "R9G067", + id: "METGEN015", title: Resources.ErrorInvalidMethodReturnTypeLocationTitle, messageFormat: Resources.ErrorInvalidMethodReturnTypeLocationMessage, category: Category); public static DiagnosticDescriptor ErrorInvalidMethodReturnTypeArity { get; } = Make( - id: "R9G068", + id: "METGEN016", title: Resources.ErrorInvalidMethodReturnTypeArityTitle, messageFormat: Resources.ErrorInvalidMethodReturnTypeArityMessage, category: Category); public static DiagnosticDescriptor ErrorGaugeNotSupported { get; } = Make( - id: "R9G069", + id: "METGEN017", title: Resources.ErrorGaugeNotSupportedTitle, messageFormat: Resources.ErrorGaugeNotSupportedMessage, category: Category); public static DiagnosticDescriptor ErrorXmlNotLoadedCorrectly { get; } = Make( - id: "R9G070", + id: "METGEN018", title: Resources.ErrorXmlNotLoadedCorrectlyTitle, messageFormat: Resources.ErrorXmlNotLoadedCorrectlyMessage, category: Category); public static DiagnosticDescriptor ErrorTagTypeCycleDetected { get; } = Make( - id: "R9G071", + id: "METGEN019", title: Resources.ErrorTagTypeCycleDetectedTitle, messageFormat: Resources.ErrorTagTypeCycleDetectedMessage, category: Category); diff --git a/src/Generators/Microsoft.Gen.MeteringReports/MeteringReportsGenerator.cs b/src/Generators/Microsoft.Gen.MeteringReports/MeteringReportsGenerator.cs index 90165e88e77..8183225f277 100644 --- a/src/Generators/Microsoft.Gen.MeteringReports/MeteringReportsGenerator.cs +++ b/src/Generators/Microsoft.Gen.MeteringReports/MeteringReportsGenerator.cs @@ -68,9 +68,7 @@ public void Execute(GeneratorExecutionContext context) var reportedMetrics = MapToCommonModel(meteringClasses, rootNamespace); var report = emitter.GenerateReport(reportedMetrics, context.CancellationToken); -#pragma warning disable R9A017 // Switch to an asynchronous metricMethod for increased performance; Cannot because it is void metricMethod, and generators dont support tasks. File.WriteAllText(Path.Combine(path, FileName), report, Encoding.UTF8); -#pragma warning restore R9A017 // Switch to an asynchronous metricMethod for increased performance; Cannot because it is void metricMethod, and generators dont support tasks. } private static ReportedMetricClass[] MapToCommonModel(IReadOnlyList meteringClasses, string? rootNamespace) diff --git a/src/LegacySupport/.editorconfig b/src/LegacySupport/.editorconfig index 627a654267f..2054f20b775 100644 --- a/src/LegacySupport/.editorconfig +++ b/src/LegacySupport/.editorconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:51Z +# Generated : 2023-08-07 17:59:52Z # Max Tier : 2147483647 # Attributes: general, performance, production -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers [*.cs] @@ -104,6 +104,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = warning +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = warning + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -474,6 +479,11 @@ dotnet_diagnostic.CA1507.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 dotnet_diagnostic.CA1508.severity = warning +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Invalid entry in code metrics rule specification file # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509 @@ -791,7 +801,7 @@ dotnet_diagnostic.CA1847.severity = warning # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use R9 logging model instead +# Comment : Use the code generated model instead. dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -812,7 +822,6 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -# Redundant: R9A013 dotnet_diagnostic.CA1852.severity = none # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' @@ -843,23 +852,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = warning # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = warning # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = warning + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = warning + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = warning + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = warning + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1175,6 +1219,11 @@ dotnet_diagnostic.CA2259.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = warning +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1670,6 +1719,66 @@ dotnet_diagnostic.CA5404.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = warning +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = warning + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = warning + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = warning + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = warning + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = warning + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = warning + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = warning + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = warning + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = warning + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = warning + # Title : Set MSBuild property 'GenerateDocumentationFile' to 'true' # Category : Style # Help Link: https://github.com/dotnet/roslyn/issues/41640 @@ -1968,7 +2077,7 @@ dotnet_diagnostic.IDE0051.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0052 dotnet_diagnostic.IDE0052.severity = warning -# Title : Use block body for lambda expression +# Title : Use expression body for lambda expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0053 # Comment : This metadata was entered manually, since it is not exposed in the normal way from the analyzer assembly. @@ -2107,7 +2216,7 @@ dotnet_style_prefer_simplified_interpolation = true # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0072 dotnet_diagnostic.IDE0072.severity = silent -# Title : The file header does not match the required text +# Title : The file header is missing or not located at the top of the file # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0073 dotnet_diagnostic.IDE0073.severity = warning @@ -2286,6 +2395,21 @@ dotnet_diagnostic.IDE0270.severity = silent # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0280 dotnet_diagnostic.IDE0280.severity = silent +# Title : Use primary constructor +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0290 +dotnet_diagnostic.IDE0290.severity = none + +# Title : Simplify collection initialization +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0300 +dotnet_diagnostic.IDE0300.severity = none + +# Title : Simplify collection initialization +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0301 +dotnet_diagnostic.IDE0301.severity = suggestion + # Title : Delegate invocation can be simplified. # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1005 @@ -2587,7 +2711,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = warning @@ -2669,155 +2793,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = warning - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = warning +dotnet_diagnostic.LA0000.severity = warning # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = warning - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = warning - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = warning - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = warning - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = warning - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = warning - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = none - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = warning - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = warning - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = warning +dotnet_diagnostic.LA0001.severity = warning # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = warning - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = warning - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = warning - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = warning - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = warning +dotnet_diagnostic.LA0002.severity = warning # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = none +dotnet_diagnostic.LA0003.severity = none # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = none +dotnet_diagnostic.LA0004.severity = none # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = none +dotnet_diagnostic.LA0005.severity = none # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = none - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = none - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = none +dotnet_diagnostic.LA0006.severity = none # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = none - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = warning +dotnet_diagnostic.LA0007.severity = none # Title : # Category : Style @@ -3597,7 +3603,8 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3906,7 +3913,7 @@ dotnet_diagnostic.S3257.severity = warning # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: R9A013 +# Redundant: CA1852 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4870,7 +4877,7 @@ dotnet_diagnostic.S5773.severity = warning # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Libraries/.editorconfig b/src/Libraries/.editorconfig index 0a33517344d..6aa37ca1689 100644 --- a/src/Libraries/.editorconfig +++ b/src/Libraries/.editorconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:50Z +# Generated : 2023-08-07 17:59:51Z # Max Tier : 2147483647 # Attributes: api, general, performance, production -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers [*.cs] @@ -105,6 +105,11 @@ dotnet_code_quality.CA1000.api_surface = public # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = warning +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = warning + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -487,6 +492,11 @@ dotnet_diagnostic.CA1507.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 dotnet_diagnostic.CA1508.severity = warning +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Invalid entry in code metrics rule specification file # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509 @@ -811,7 +821,7 @@ dotnet_diagnostic.CA1847.severity = warning # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use R9 logging model instead +# Comment : Use the code generated model instead. dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -832,7 +842,6 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -# Redundant: R9A013 dotnet_diagnostic.CA1852.severity = none # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' @@ -863,23 +872,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = warning # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = warning # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = warning + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = warning + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = warning + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = warning + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1197,6 +1241,11 @@ dotnet_diagnostic.CA2259.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = warning +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1692,6 +1741,66 @@ dotnet_diagnostic.CA5404.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = warning +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = warning + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = warning + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = warning + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = warning + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = warning + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = warning + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = warning + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = warning + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = warning + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = warning + # Title : Set MSBuild property 'GenerateDocumentationFile' to 'true' # Category : Style # Help Link: https://github.com/dotnet/roslyn/issues/41640 @@ -1990,7 +2099,7 @@ dotnet_diagnostic.IDE0051.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0052 dotnet_diagnostic.IDE0052.severity = warning -# Title : Use block body for lambda expression +# Title : Use expression body for lambda expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0053 # Comment : This metadata was entered manually, since it is not exposed in the normal way from the analyzer assembly. @@ -2129,7 +2238,7 @@ dotnet_style_prefer_simplified_interpolation = true # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0072 dotnet_diagnostic.IDE0072.severity = silent -# Title : The file header does not match the required text +# Title : The file header is missing or not located at the top of the file # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0073 dotnet_diagnostic.IDE0073.severity = warning @@ -2308,6 +2417,21 @@ dotnet_diagnostic.IDE0270.severity = silent # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0280 dotnet_diagnostic.IDE0280.severity = silent +# Title : Use primary constructor +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0290 +dotnet_diagnostic.IDE0290.severity = none + +# Title : Simplify collection initialization +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0300 +dotnet_diagnostic.IDE0300.severity = none + +# Title : Simplify collection initialization +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0301 +dotnet_diagnostic.IDE0301.severity = suggestion + # Title : Delegate invocation can be simplified. # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1005 @@ -2609,7 +2733,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = warning @@ -2691,155 +2815,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = warning - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = warning +dotnet_diagnostic.LA0000.severity = warning # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = warning - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = warning - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = warning - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = warning - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = warning - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = warning - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = none - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = warning - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = warning - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = warning +dotnet_diagnostic.LA0001.severity = warning # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = warning - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = warning - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = warning - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = warning - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = warning +dotnet_diagnostic.LA0002.severity = warning # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = warning +dotnet_diagnostic.LA0003.severity = warning # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = warning +dotnet_diagnostic.LA0004.severity = warning # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = warning +dotnet_diagnostic.LA0005.severity = warning # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = warning - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = warning - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = warning +dotnet_diagnostic.LA0006.severity = warning # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = warning - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = warning +dotnet_diagnostic.LA0007.severity = warning # Title : # Category : Style @@ -3619,7 +3625,8 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3928,7 +3935,7 @@ dotnet_diagnostic.S3257.severity = warning # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: R9A013 +# Redundant: CA1852 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4892,7 +4899,7 @@ dotnet_diagnostic.S5773.severity = warning # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Libraries/Directory.Build.props b/src/Libraries/Directory.Build.props index 3d0c4d67235..73171854d92 100644 --- a/src/Libraries/Directory.Build.props +++ b/src/Libraries/Directory.Build.props @@ -3,7 +3,7 @@ $(NetCoreTargetFrameworks)$(ConditionalNet462) - true + true true true diff --git a/src/Libraries/Microsoft.AspNetCore.HeaderParsing/Metric.cs b/src/Libraries/Microsoft.AspNetCore.HeaderParsing/Metric.cs index be4f2512151..a11e39e9b4e 100644 --- a/src/Libraries/Microsoft.AspNetCore.HeaderParsing/Metric.cs +++ b/src/Libraries/Microsoft.AspNetCore.HeaderParsing/Metric.cs @@ -8,9 +8,9 @@ namespace Microsoft.AspNetCore.HeaderParsing; internal static partial class Metric { - [Counter("HeaderName", "Kind", Name = @"R9.HeaderParsing.ParsingErrors")] + [Counter("HeaderName", "Kind", Name = @"HeaderParsing.ParsingErrors")] public static partial ParsingErrorCounter CreateParsingErrorCounter(Meter meter); - [Counter("HeaderName", "Type", Name = @"R9.HeaderParsing.CacheAccess")] + [Counter("HeaderName", "Type", Name = @"HeaderParsing.CacheAccess")] public static partial CacheAccessCounter CreateCacheAccessCounter(Meter meter); } diff --git a/src/Libraries/Microsoft.AspNetCore.Telemetry.Middleware/Latency/Internal/RequestLatencyTelemetryMiddleware.cs b/src/Libraries/Microsoft.AspNetCore.Telemetry.Middleware/Latency/Internal/RequestLatencyTelemetryMiddleware.cs index 1f089feb966..3d8c23d0ac3 100644 --- a/src/Libraries/Microsoft.AspNetCore.Telemetry.Middleware/Latency/Internal/RequestLatencyTelemetryMiddleware.cs +++ b/src/Libraries/Microsoft.AspNetCore.Telemetry.Middleware/Latency/Internal/RequestLatencyTelemetryMiddleware.cs @@ -75,7 +75,7 @@ public Task InvokeAsync(HttpContext context, RequestDelegate next) return next.Invoke(context); } - [SuppressMessage("Resilience", "R9A061:The async method doesn't support cancellation", Justification = "The time limit is enforced inside of the method")] + [SuppressMessage("Resilience", "EA0014:The async method doesn't support cancellation", Justification = "The time limit is enforced inside of the method")] private async Task ExportAsync(LatencyData latencyData) { var tokenSource = _cancellationTokenSourcePool.Get(); diff --git a/src/Libraries/Microsoft.AspNetCore.Telemetry.Middleware/Logging/Internal/Log.cs b/src/Libraries/Microsoft.AspNetCore.Telemetry.Middleware/Logging/Internal/Log.cs index 4f4314ad72a..3a2d35c9a9e 100644 --- a/src/Libraries/Microsoft.AspNetCore.Telemetry.Middleware/Logging/Internal/Log.cs +++ b/src/Libraries/Microsoft.AspNetCore.Telemetry.Middleware/Logging/Internal/Log.cs @@ -125,12 +125,12 @@ IEnumerator IEnumerable.GetEnumerator() [LogMethod(4, LogLevel.Error, ReadingResponseBodyError)] public static partial void ErrorReadingResponseBody(this ILogger logger, Exception ex); -#pragma warning disable R9G001 +#pragma warning disable LOGGEN000 [LogMethod(5, LogLevel.Warning, $"HttpLogging middleware is injected into application pipeline, but {nameof(LogLevel)} '{{logLevel}}' is disabled in logger. " + "Remove {methodName}() call from pipeline configuration in that case.")] public static partial void MiddlewareIsMisused(this ILogger logger, LogLevel logLevel, string methodName); -#pragma warning restore R9G001 +#pragma warning restore LOGGEN000 private static string OriginalFormatValueFMT(IncomingRequestStruct request, Exception? _) { diff --git a/src/Libraries/Microsoft.AspNetCore.Telemetry.Middleware/Logging/Internal/ResponseInterceptingStream.cs b/src/Libraries/Microsoft.AspNetCore.Telemetry.Middleware/Logging/Internal/ResponseInterceptingStream.cs index 115f6091f1f..b6231ed1461 100644 --- a/src/Libraries/Microsoft.AspNetCore.Telemetry.Middleware/Logging/Internal/ResponseInterceptingStream.cs +++ b/src/Libraries/Microsoft.AspNetCore.Telemetry.Middleware/Logging/Internal/ResponseInterceptingStream.cs @@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Telemetry.Http.Logging; /// Intercepts data being written to stream and writes its copy to another data structure. /// /// -/// Copied from ASP .NET and adjusted to R9 needs. +/// Copied from ASP .NET and adjusted for current needs. /// internal sealed class ResponseInterceptingStream : Stream, IHttpResponseBodyFeature { diff --git a/src/Libraries/Microsoft.AspNetCore.Testing/Internal/FakeSslCertificateFactory.cs b/src/Libraries/Microsoft.AspNetCore.Testing/Internal/FakeSslCertificateFactory.cs index 8c1859050df..80e45712132 100644 --- a/src/Libraries/Microsoft.AspNetCore.Testing/Internal/FakeSslCertificateFactory.cs +++ b/src/Libraries/Microsoft.AspNetCore.Testing/Internal/FakeSslCertificateFactory.cs @@ -19,7 +19,7 @@ internal static class FakeSslCertificateFactory /// Creates a self-signed instance for testing. /// /// An instance for testing. - [SuppressMessage("Reliability", "R9A022:Use System.TimeProvider when dealing with time in your code.", Justification = "declarations")] + [SuppressMessage("Reliability", "EA0002:Use System.TimeProvider when dealing with time in your code.", Justification = "declarations")] public static X509Certificate2 CreateSslCertificate() { var request = new CertificateRequest( diff --git a/src/Libraries/Microsoft.Extensions.AsyncState/AsyncState.cs b/src/Libraries/Microsoft.Extensions.AsyncState/AsyncState.cs index 3c515907b41..4d782409238 100644 --- a/src/Libraries/Microsoft.Extensions.AsyncState/AsyncState.cs +++ b/src/Libraries/Microsoft.Extensions.AsyncState/AsyncState.cs @@ -52,7 +52,9 @@ public AsyncStateToken RegisterAsyncContext() public bool TryGet(AsyncStateToken token, out object? value) { // Context is not initialized +#pragma warning disable EA0011 if (_asyncContextCurrent.Value?.Features == null) +#pragma warning restore EA0011 { value = null; return false; @@ -77,7 +79,9 @@ public bool TryGet(AsyncStateToken token, out object? value) public void Set(AsyncStateToken token, object? value) { // Context is not initialized +#pragma warning disable EA0011 if (_asyncContextCurrent.Value?.Features == null) +#pragma warning restore EA0011 { Throw.InvalidOperationException("Context is not initialized"); } diff --git a/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/Microsoft.Extensions.DependencyInjection.AutoActivation.json b/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/Microsoft.Extensions.DependencyInjection.AutoActivation.json index 448a8839b47..4ed10397792 100644 --- a/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/Microsoft.Extensions.DependencyInjection.AutoActivation.json +++ b/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/Microsoft.Extensions.DependencyInjection.AutoActivation.json @@ -6,8 +6,48 @@ "Stage": "Stable", "Methods": [ { - "Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.Activate(this Microsoft.Extensions.DependencyInjection.IServiceCollection services);", - "Stage": "Stable" + "Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.ActivateKeyedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, object? serviceKey);", + "Stage": "Experimental" + }, + { + "Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.ActivateKeyedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Type serviceType, object? serviceKey);", + "Stage": "Experimental" + }, + { + "Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.ActivateSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services);", + "Stage": "Experimental" + }, + { + "Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.ActivateSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Type serviceType);", + "Stage": "Experimental" + }, + { + "Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.AddActivatedKeyedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, object? serviceKey, System.Func implementationFactory);", + "Stage": "Experimental" + }, + { + "Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.AddActivatedKeyedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, object? serviceKey);", + "Stage": "Experimental" + }, + { + "Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.AddActivatedKeyedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, object? serviceKey, System.Func implementationFactory);", + "Stage": "Experimental" + }, + { + "Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.AddActivatedKeyedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, object? serviceKey);", + "Stage": "Experimental" + }, + { + "Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.AddActivatedKeyedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Type serviceType, object? serviceKey);", + "Stage": "Experimental" + }, + { + "Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.AddActivatedKeyedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Type serviceType, object? serviceKey, System.Func implementationFactory);", + "Stage": "Experimental" + }, + { + "Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.AddActivatedKeyedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Type serviceType, object? serviceKey, System.Type implementationType);", + "Stage": "Experimental" }, { "Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.AddActivatedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Func implementationFactory);", @@ -37,6 +77,30 @@ "Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.AddActivatedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Type serviceType, System.Type implementationType);", "Stage": "Stable" }, + { + "Member": "static void Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.TryAddActivatedKeyedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Type serviceType, object? serviceKey);", + "Stage": "Experimental" + }, + { + "Member": "static void Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.TryAddActivatedKeyedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Type serviceType, object? serviceKey, System.Type implementationType);", + "Stage": "Experimental" + }, + { + "Member": "static void Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.TryAddActivatedKeyedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Type serviceType, object? serviceKey, System.Func implementationFactory);", + "Stage": "Experimental" + }, + { + "Member": "static void Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.TryAddActivatedKeyedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, object? serviceKey);", + "Stage": "Experimental" + }, + { + "Member": "static void Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.TryAddActivatedKeyedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, object? serviceKey);", + "Stage": "Experimental" + }, + { + "Member": "static void Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.TryAddActivatedKeyedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, object? serviceKey, System.Func implementationFactory);", + "Stage": "Experimental" + }, { "Member": "static void Microsoft.Extensions.DependencyInjection.AutoActivationExtensions.TryAddActivatedSingleton(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Type serviceType);", "Stage": "Stable" diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization/ResourceUtilizationHealthCheck.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization/ResourceUtilizationHealthCheck.cs index c3d104abe60..b60a6068b50 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization/ResourceUtilizationHealthCheck.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization/ResourceUtilizationHealthCheck.cs @@ -39,22 +39,22 @@ public ResourceUtilizationHealthCheck(IOptions CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default) { var utilization = _dataTracker.GetUtilization(_options.SamplingWindow); - if (utilization.CpuUsedPercentage > _options.CpuThresholds?.UnhealthyUtilizationPercentage) + if (utilization.CpuUsedPercentage > _options.CpuThresholds.UnhealthyUtilizationPercentage) { return Task.FromResult(HealthCheckResult.Unhealthy("CPU usage is above the limit")); } - if (utilization.MemoryUsedPercentage > _options.MemoryThresholds?.UnhealthyUtilizationPercentage) + if (utilization.MemoryUsedPercentage > _options.MemoryThresholds.UnhealthyUtilizationPercentage) { return Task.FromResult(HealthCheckResult.Unhealthy("Memory usage is above the limit")); } - if (utilization.CpuUsedPercentage > _options.CpuThresholds?.DegradedUtilizationPercentage) + if (utilization.CpuUsedPercentage > _options.CpuThresholds.DegradedUtilizationPercentage) { return Task.FromResult(HealthCheckResult.Degraded("CPU usage is close to the limit")); } - if (utilization.MemoryUsedPercentage > _options.MemoryThresholds?.DegradedUtilizationPercentage) + if (utilization.MemoryUsedPercentage > _options.MemoryThresholds.DegradedUtilizationPercentage) { return Task.FromResult(HealthCheckResult.Degraded("Memory usage is close to the limit")); } diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/Internal/LinuxUtilizationProvider.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/Internal/LinuxUtilizationProvider.cs index 1a091c1b9a2..f4ab4a7ef68 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/Internal/LinuxUtilizationProvider.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/Internal/LinuxUtilizationProvider.cs @@ -4,7 +4,6 @@ using System; using Microsoft.Extensions.Options; using Microsoft.Extensions.Telemetry.Metering; -using Microsoft.Shared.Diagnostics; namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring.Internal; @@ -34,8 +33,6 @@ internal sealed class LinuxUtilizationProvider : ISnapshotProvider public LinuxUtilizationProvider(IOptions options, LinuxUtilizationParser parser, Meter meter, IOperatingSystem os, TimeProvider? timeProvider = null) { - _ = Throw.IfMemberNull(options, options?.Value); - if (!os.IsLinux) { throw new NotSupportedException($"Method 'AddLinuxProvider' was used on '{Environment.OSVersion.Platform}' while it was expected to run on Linux."); diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/Internal/OSFileSystem.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/Internal/OSFileSystem.cs index 3a8ece82fee..794aab1d652 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/Internal/OSFileSystem.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/Internal/OSFileSystem.cs @@ -9,8 +9,6 @@ namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring.Internal; -#pragma warning disable R9A017 // Use asynchronous operations instead of legacy thread blocking code - /// /// We are reading files from /proc and /cgroup. Those files are dynamically generated by kernel, when the access to them is requested. /// Those files then, are stored entirely in RAM; it is called Virtual File System (VFS). The access to the files is done by syscall that is non blocking. diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Microsoft.Extensions.Diagnostics.ResourceMonitoring.csproj b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Microsoft.Extensions.Diagnostics.ResourceMonitoring.csproj index 4b05933312f..bbaf3b5cb5c 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Microsoft.Extensions.Diagnostics.ResourceMonitoring.csproj +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Microsoft.Extensions.Diagnostics.ResourceMonitoring.csproj @@ -6,6 +6,9 @@ + + $(NoWarn);LA0006 + true true true diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Windows/Internal/WindowsContainerSnapshotProvider.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Windows/Internal/WindowsContainerSnapshotProvider.cs index e98aae20dd0..9ee72573705 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Windows/Internal/WindowsContainerSnapshotProvider.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Windows/Internal/WindowsContainerSnapshotProvider.cs @@ -133,7 +133,7 @@ private ulong GetMemoryLimits(IJobHandle jobHandle) var memoryStatus = _memoryStatus.Value; // Technically, the unconstrained limit is memoryStatus.TotalPageFile. - // Leaving this at physical as it is more understandable to R9 consumers at present. + // Leaving this at physical as it is more understandable to consumers. memoryLimitInBytes = memoryStatus.TotalPhys; } diff --git a/src/Libraries/Microsoft.Extensions.Http.AutoClient/AutoClientAttribute.cs b/src/Libraries/Microsoft.Extensions.Http.AutoClient/AutoClientAttribute.cs index e6d64c796cc..da5288cab56 100644 --- a/src/Libraries/Microsoft.Extensions.Http.AutoClient/AutoClientAttribute.cs +++ b/src/Libraries/Microsoft.Extensions.Http.AutoClient/AutoClientAttribute.cs @@ -43,7 +43,7 @@ public AutoClientAttribute(string httpClientName) /// Initializes a new instance of the class. /// /// The name of the HTTP client to be retrieved from . - /// The dependency name override to be used with R9 Telemetry. + /// The dependency name override to use. public AutoClientAttribute(string httpClientName, string customDependencyName) { HttpClientName = httpClientName; diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Microsoft.Extensions.Http.Resilience.csproj b/src/Libraries/Microsoft.Extensions.Http.Resilience/Microsoft.Extensions.Http.Resilience.csproj index 8d7046a0e7c..1dc52a58abf 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Microsoft.Extensions.Http.Resilience.csproj +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Microsoft.Extensions.Http.Resilience.csproj @@ -3,7 +3,6 @@ Microsoft.Extensions.Http.Resilience Resilience mechanisms for HTTP Client. Resilience - $(NoWarn);R9A049 diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/HttpClientBuilderExtensions.Resilience.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/HttpClientBuilderExtensions.Resilience.cs index 3ed74167a91..d9313682e81 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/HttpClientBuilderExtensions.Resilience.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/HttpClientBuilderExtensions.Resilience.cs @@ -110,7 +110,7 @@ private static void TouchStrategyKey(Func provider) _ = provider(request); } - private static IHttpResilienceStrategyBuilder AddHttpResilienceStrategy( + private static HttpResilienceStrategyBuilder AddHttpResilienceStrategy( this IHttpClientBuilder builder, string name, Action, ResilienceHandlerContext> configure) @@ -122,7 +122,7 @@ private static IHttpResilienceStrategyBuilder AddHttpResilienceStrategy( ConfigureHttpServices(builder.Services); - return new HttpResilienceStrategyBuilder(strategyName, builder.Services); + return new(strategyName, builder.Services); } private static void ConfigureHttpServices(IServiceCollection services) diff --git a/src/Libraries/Microsoft.Extensions.Http.Telemetry/Logging/Internal/Log.cs b/src/Libraries/Microsoft.Extensions.Http.Telemetry/Logging/Internal/Log.cs index be4c34c2ed8..2a0758d69ef 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Telemetry/Logging/Internal/Log.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Telemetry/Logging/Internal/Log.cs @@ -30,7 +30,6 @@ public static void OutgoingRequestError(ILogger logger, LogRecord record, Except public static partial void EnrichmentError(ILogger logger, Exception exception); // Using the code below to avoid every item in ILogger's logRecord State being prefixed with parameter name. - // To be fixed in R9 later. private static void OutgoingRequest( ILogger logger, LogLevel level, int eventId, string eventName, LogRecord record, Exception? exception = null) { diff --git a/src/Libraries/Microsoft.Extensions.Http.Telemetry/Metering/Internal/HttpClientRequestAdapter.cs b/src/Libraries/Microsoft.Extensions.Http.Telemetry/Metering/Internal/HttpClientRequestAdapter.cs index ac6d9476198..930cd62ea70 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Telemetry/Metering/Internal/HttpClientRequestAdapter.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Telemetry/Metering/Internal/HttpClientRequestAdapter.cs @@ -13,9 +13,7 @@ namespace Microsoft.Extensions.Http.Telemetry.Metering.Internal; -#pragma warning disable R9A013 // This class has virtual members and can't be sealed. internal class HttpClientRequestAdapter -#pragma warning restore R9A013 // This class has virtual members and can't be sealed. { internal TimeProvider TimeProvider = TimeProvider.System; diff --git a/src/Libraries/Microsoft.Extensions.Http.Telemetry/Microsoft.Extensions.Http.Telemetry.csproj b/src/Libraries/Microsoft.Extensions.Http.Telemetry/Microsoft.Extensions.Http.Telemetry.csproj index b85fd46466f..e4ef2b8fab4 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Telemetry/Microsoft.Extensions.Http.Telemetry.csproj +++ b/src/Libraries/Microsoft.Extensions.Http.Telemetry/Microsoft.Extensions.Http.Telemetry.csproj @@ -6,6 +6,9 @@ + + $(NoWarn);LA0006 + true true true diff --git a/src/Libraries/Microsoft.Extensions.Resilience/Resilience/GlobalSuppressions.cs b/src/Libraries/Microsoft.Extensions.Resilience/Resilience/GlobalSuppressions.cs deleted file mode 100644 index 5ce4d7eee2a..00000000000 --- a/src/Libraries/Microsoft.Extensions.Resilience/Resilience/GlobalSuppressions.cs +++ /dev/null @@ -1,6 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Diagnostics.CodeAnalysis; - -[assembly: SuppressMessage("Misc", "CS8002", Justification = "Referenced assemblies from within R9 SDK without strong name are accepted")] diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Testing/Logging/FakeLogCollector.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Testing/Logging/FakeLogCollector.cs index c8aa3dbd6f7..68cad7ed9bd 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Testing/Logging/FakeLogCollector.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Testing/Logging/FakeLogCollector.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#pragma warning disable R9A052 - using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Testing/Logging/FakeLogRecord.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Testing/Logging/FakeLogRecord.cs index 533894af852..c2d9efeb051 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Testing/Logging/FakeLogRecord.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Testing/Logging/FakeLogRecord.cs @@ -59,7 +59,7 @@ public FakeLogRecord(LogLevel level, EventId id, object? state, Exception? excep /// Gets the opaque state supplied by the caller when creating the log record as a read-only list. /// /// - /// When logging using the R9 logging model, the arguments you supply to the logging method are packaged into a single state object which is delivered to the + /// When logging using the code generator logging model, the arguments you supply to the logging method are packaged into a single state object which is delivered to the /// method. This state can be retrieved as a set of name/value pairs encoded in a read-only list. /// /// The object returned by this property is the same as what returns, except it has been cast to a read-only list. diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Testing/Metering/MetricCollector.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Testing/Metering/MetricCollector.cs index 9e34bc64eb6..af43c3243df 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Testing/Metering/MetricCollector.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Testing/Metering/MetricCollector.cs @@ -249,7 +249,7 @@ public Task WaitForMeasurementsAsync(int minCount, CancellationToken cancellatio /// The minimum number of measurements to wait for. /// How long to wait. /// A task that completes when the collector has collected the requisite number of measurements. - [SuppressMessage("Resilience", "R9A061:The async method doesn't support cancellation", Justification = "Not relevant in this case")] + [SuppressMessage("Resilience", "EA0014:The async method doesn't support cancellation", Justification = "Not relevant in this case")] public async Task WaitForMeasurementsAsync(int minCount, TimeSpan timeout) { #if NET8_0_OR_GREATER diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Logging/ExtendedLogger.cs b/src/Libraries/Microsoft.Extensions.Telemetry/Logging/ExtendedLogger.cs index d988c0b244f..3046d7d0199 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry/Logging/ExtendedLogger.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry/Logging/ExtendedLogger.cs @@ -160,9 +160,7 @@ void HandleException(Exception exception, int indent) #if NETCOREAPP3_1_OR_GREATER trace = trace.Replace(Environment.NewLine, Environment.NewLine + indentStr + " ", StringComparison.Ordinal).Trim(' '); #else -#pragma warning disable R9A044 // Assign array of literal values to a static field for improved performance trace = trace.Replace(Environment.NewLine, Environment.NewLine + indentStr + " ").Trim(' '); -#pragma warning restore R9A044 // Assign array of literal values to a static field for improved performance #endif _ = sb.Append(exception.GetType()); diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Logging/Import/LoggerFactoryScopeProvider.cs b/src/Libraries/Microsoft.Extensions.Telemetry/Logging/Import/LoggerFactoryScopeProvider.cs index d4f5bc95b68..3e18106972d 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry/Logging/Import/LoggerFactoryScopeProvider.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry/Logging/Import/LoggerFactoryScopeProvider.cs @@ -17,7 +17,6 @@ #pragma warning disable S2551 // Lock on a dedicated object instance instead #pragma warning disable SA1204 // Static elements should appear before instance elements #pragma warning disable SA1402 // File may only contain a single type -#pragma warning disable R9A015 using System; using System.Text; @@ -25,6 +24,7 @@ using System.Collections; using System.Diagnostics; using System.Collections.Generic; +using Microsoft.Shared.Diagnostics; namespace Microsoft.Extensions.Logging { @@ -192,7 +192,7 @@ public ActivityLogScope(Activity activity, ActivityTrackingOptions activityTrack { if (index >= Count) { - throw new ArgumentOutOfRangeException(nameof(index)); + Throw.ArgumentOutOfRangeException(nameof(index)); } return _items[index]; diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Metering.Collectors.EventCounters/Internal/Constants.cs b/src/Libraries/Microsoft.Extensions.Telemetry/Metering.Collectors.EventCounters/Internal/Constants.cs index f3cbd75663d..35a4b6d09a7 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry/Metering.Collectors.EventCounters/Internal/Constants.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry/Metering.Collectors.EventCounters/Internal/Constants.cs @@ -7,7 +7,6 @@ namespace Microsoft.Extensions.Telemetry.Metering.Internal; internal sealed class Constants { -#pragma warning disable R9A044 // Assign array of literal values to a static field for improved performance public static readonly Dictionary> DefaultCounters = new() { ["System.Runtime"] = new HashSet @@ -30,5 +29,4 @@ internal sealed class Constants "request-queue-length", }, }; -#pragma warning restore R9A044 // Assign array of literal values to a static field for improved performance } diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Telemetry.Internal/SelfDiagnosticsConfigParser.cs b/src/Libraries/Microsoft.Extensions.Telemetry/Telemetry.Internal/SelfDiagnosticsConfigParser.cs index 61c91babe56..3246a32fd32 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry/Telemetry.Internal/SelfDiagnosticsConfigParser.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry/Telemetry.Internal/SelfDiagnosticsConfigParser.cs @@ -118,9 +118,6 @@ internal virtual int SetFileSizeWithinLimit(int fileSizeInKb) return fileSizeInKb; } - [System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", - "R9A017:Use asynchronous operations instead of legacy thread blocking code", - Justification = "Imported from OpenTelemetry-dotnet repo.")] internal virtual bool TryReadConfigFile(string configFilePath, out string configJson) { configJson = string.Empty; diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Telemetry.Internal/SelfDiagnosticsConfigRefresher.cs b/src/Libraries/Microsoft.Extensions.Telemetry/Telemetry.Internal/SelfDiagnosticsConfigRefresher.cs index 591db429ff2..19750900213 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry/Telemetry.Internal/SelfDiagnosticsConfigRefresher.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry/Telemetry.Internal/SelfDiagnosticsConfigRefresher.cs @@ -241,9 +241,6 @@ private void CloseLogFile() fs?.Dispose(); } - [SuppressMessage("Performance", - "R9A017:Use asynchronous operations instead of legacy thread blocking code", - Justification = "Borrowed from OpenTelemetry-dotnet as is.")] private void OpenLogFile(string newLogDirectory, int newFileSize) { try diff --git a/src/Libraries/System.Cloud.Messaging/Abstractions/Interfaces/IMessageDestination.cs b/src/Libraries/System.Cloud.Messaging/Abstractions/Interfaces/IMessageDestination.cs index b4cd75e2773..dd05e6a8c96 100644 --- a/src/Libraries/System.Cloud.Messaging/Abstractions/Interfaces/IMessageDestination.cs +++ b/src/Libraries/System.Cloud.Messaging/Abstractions/Interfaces/IMessageDestination.cs @@ -17,6 +17,6 @@ public interface IMessageDestination /// /// The message context. /// . - [SuppressMessage("Resilience", "R9A061:The async method doesn't support cancellation", Justification = $"{nameof(MessageContext)} has {nameof(CancellationToken)}")] + [SuppressMessage("Resilience", "EA0014:The async method doesn't support cancellation", Justification = $"{nameof(MessageContext)} has {nameof(CancellationToken)}")] public ValueTask WriteAsync(MessageContext context); } diff --git a/src/Libraries/System.Cloud.Messaging/Abstractions/Interfaces/IMessageMiddleware.cs b/src/Libraries/System.Cloud.Messaging/Abstractions/Interfaces/IMessageMiddleware.cs index d90908da294..cff3995cb07 100644 --- a/src/Libraries/System.Cloud.Messaging/Abstractions/Interfaces/IMessageMiddleware.cs +++ b/src/Libraries/System.Cloud.Messaging/Abstractions/Interfaces/IMessageMiddleware.cs @@ -21,6 +21,6 @@ public interface IMessageMiddleware /// The message context. /// The next handler in the async processing pipeline. /// . - [SuppressMessage("Resilience", "R9A061:The async method doesn't support cancellation", Justification = $"{nameof(MessageContext)} has {nameof(CancellationToken)}")] + [SuppressMessage("Resilience", "EA0014:The async method doesn't support cancellation", Justification = $"{nameof(MessageContext)} has {nameof(CancellationToken)}")] ValueTask InvokeAsync(MessageContext context, MessageDelegate nextHandler); } diff --git a/src/Libraries/System.Cloud.Messaging/Abstractions/Interfaces/MessageConsumer.cs b/src/Libraries/System.Cloud.Messaging/Abstractions/Interfaces/MessageConsumer.cs index f3751d5b2ce..f0a1fef439a 100644 --- a/src/Libraries/System.Cloud.Messaging/Abstractions/Interfaces/MessageConsumer.cs +++ b/src/Libraries/System.Cloud.Messaging/Abstractions/Interfaces/MessageConsumer.cs @@ -72,7 +72,7 @@ public async virtual ValueTask ExecuteAsync(CancellationToken cancellationToken) /// The message context. /// The exception during the processing of the message. /// . - [SuppressMessage("Resilience", "R9A061:The async method doesn't support cancellation", Justification = $"{nameof(MessageContext)} has {nameof(CancellationToken)}")] + [SuppressMessage("Resilience", "EA0014:The async method doesn't support cancellation", Justification = $"{nameof(MessageContext)} has {nameof(CancellationToken)}")] protected abstract ValueTask HandleMessageProcessingFailureAsync(MessageContext context, Exception exception); /// @@ -81,7 +81,7 @@ public async virtual ValueTask ExecuteAsync(CancellationToken cancellationToken) /// Default behavior is to to not do anything and can be updated by the implementation class as per the requirement. /// The message context. /// . - [SuppressMessage("Resilience", "R9A061:The async method doesn't support cancellation", Justification = $"{nameof(MessageContext)} has {nameof(CancellationToken)}")] + [SuppressMessage("Resilience", "EA0014:The async method doesn't support cancellation", Justification = $"{nameof(MessageContext)} has {nameof(CancellationToken)}")] protected virtual ValueTask HandleMessageProcessingCompletionAsync(MessageContext context) => default; /// @@ -177,7 +177,7 @@ protected virtual async ValueTask FetchAndProcessMessageAsync(CancellationToken /// /// The message context. /// . - [SuppressMessage("Resilience", "R9A061:The async method doesn't support cancellation", Justification = $"{nameof(MessageContext)} has {nameof(CancellationToken)}")] + [SuppressMessage("Resilience", "EA0014:The async method doesn't support cancellation", Justification = $"{nameof(MessageContext)} has {nameof(CancellationToken)}")] protected virtual ValueTask ProcessMessageAsync(MessageContext context) { _ = Throw.IfNull(context); diff --git a/src/Libraries/System.Cloud.Messaging/Abstractions/Interfaces/MessageDelegate.cs b/src/Libraries/System.Cloud.Messaging/Abstractions/Interfaces/MessageDelegate.cs index 038a7bd0e33..c75f563ba8a 100644 --- a/src/Libraries/System.Cloud.Messaging/Abstractions/Interfaces/MessageDelegate.cs +++ b/src/Libraries/System.Cloud.Messaging/Abstractions/Interfaces/MessageDelegate.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics.CodeAnalysis; -using System.Threading; using System.Threading.Tasks; namespace System.Cloud.Messaging; @@ -15,6 +14,5 @@ namespace System.Cloud.Messaging; /// /// The message context. /// . -[SuppressMessage("Resilience", "R9A061:The async method doesn't support cancellation", Justification = $"{nameof(MessageContext)} has {nameof(CancellationToken)}")] [SuppressMessage("Naming", "CA1711:Identifiers should not have incorrect suffix", Justification = "Similar to RequestDelegate in ASP.NET.")] public delegate ValueTask MessageDelegate(MessageContext context); diff --git a/src/Libraries/System.Cloud.Messaging/Abstractions/Internal/Delegate/PipelineMessageDelegateStitcher.cs b/src/Libraries/System.Cloud.Messaging/Abstractions/Internal/Delegate/PipelineMessageDelegateStitcher.cs index c8d7fbf9cae..36b748e6757 100644 --- a/src/Libraries/System.Cloud.Messaging/Abstractions/Internal/Delegate/PipelineMessageDelegateStitcher.cs +++ b/src/Libraries/System.Cloud.Messaging/Abstractions/Internal/Delegate/PipelineMessageDelegateStitcher.cs @@ -34,7 +34,7 @@ public PipelineMessageDelegateStitcher(IMessageMiddleware middleware, MessageDel /// /// The message context. /// . - [SuppressMessage("Resilience", "R9A061:The async method doesn't support cancellation", Justification = $"{nameof(MessageContext)} has {nameof(CancellationToken)}")] + [SuppressMessage("Resilience", "EA0014:The async method doesn't support cancellation", Justification = $"{nameof(MessageContext)} has {nameof(CancellationToken)}")] public ValueTask InvokeAsync(MessageContext context) { return _middleware.InvokeAsync(context, _nextHandler); diff --git a/src/Libraries/System.Cloud.Messaging/System.Cloud.Messaging.json b/src/Libraries/System.Cloud.Messaging/System.Cloud.Messaging.json index bbe0e471e1e..339a2bcbf0b 100644 --- a/src/Libraries/System.Cloud.Messaging/System.Cloud.Messaging.json +++ b/src/Libraries/System.Cloud.Messaging/System.Cloud.Messaging.json @@ -6,23 +6,23 @@ "Stage": "Experimental", "Methods": [ { - "Member": "static System.Cloud.Messaging.IAsyncProcessingPipelineBuilder System.Cloud.Messaging.AsyncProcessingPipelineBuilderExtensions.AddMessageMiddleware(this System.Cloud.Messaging.IAsyncProcessingPipelineBuilder pipelineBuilder);", + "Member": "static System.Cloud.Messaging.IAsyncProcessingPipelineBuilder System.Cloud.Messaging.AsyncProcessingPipelineBuilderExtensions.AddKeyedSingleton(this System.Cloud.Messaging.IAsyncProcessingPipelineBuilder pipelineBuilder);", "Stage": "Experimental" }, { - "Member": "static System.Cloud.Messaging.IAsyncProcessingPipelineBuilder System.Cloud.Messaging.AsyncProcessingPipelineBuilderExtensions.AddMessageMiddleware(this System.Cloud.Messaging.IAsyncProcessingPipelineBuilder pipelineBuilder, System.Func implementationFactory);", + "Member": "static System.Cloud.Messaging.IAsyncProcessingPipelineBuilder System.Cloud.Messaging.AsyncProcessingPipelineBuilderExtensions.AddKeyedSingleton(this System.Cloud.Messaging.IAsyncProcessingPipelineBuilder pipelineBuilder, System.Func implementationFactory);", "Stage": "Experimental" }, { - "Member": "static System.Cloud.Messaging.IAsyncProcessingPipelineBuilder System.Cloud.Messaging.AsyncProcessingPipelineBuilderExtensions.AddNamedSingleton(this System.Cloud.Messaging.IAsyncProcessingPipelineBuilder pipelineBuilder);", + "Member": "static System.Cloud.Messaging.IAsyncProcessingPipelineBuilder System.Cloud.Messaging.AsyncProcessingPipelineBuilderExtensions.AddKeyedSingleton(this System.Cloud.Messaging.IAsyncProcessingPipelineBuilder pipelineBuilder, string name, System.Func implementationFactory);", "Stage": "Experimental" }, { - "Member": "static System.Cloud.Messaging.IAsyncProcessingPipelineBuilder System.Cloud.Messaging.AsyncProcessingPipelineBuilderExtensions.AddNamedSingleton(this System.Cloud.Messaging.IAsyncProcessingPipelineBuilder pipelineBuilder, System.Func implementationFactory);", + "Member": "static System.Cloud.Messaging.IAsyncProcessingPipelineBuilder System.Cloud.Messaging.AsyncProcessingPipelineBuilderExtensions.AddMessageMiddleware(this System.Cloud.Messaging.IAsyncProcessingPipelineBuilder pipelineBuilder);", "Stage": "Experimental" }, { - "Member": "static System.Cloud.Messaging.IAsyncProcessingPipelineBuilder System.Cloud.Messaging.AsyncProcessingPipelineBuilderExtensions.AddNamedSingleton(this System.Cloud.Messaging.IAsyncProcessingPipelineBuilder pipelineBuilder, string name, System.Func implementationFactory);", + "Member": "static System.Cloud.Messaging.IAsyncProcessingPipelineBuilder System.Cloud.Messaging.AsyncProcessingPipelineBuilderExtensions.AddMessageMiddleware(this System.Cloud.Messaging.IAsyncProcessingPipelineBuilder pipelineBuilder, System.Func implementationFactory);", "Stage": "Experimental" }, { diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/Microsoft.Extensions.StaticAnalysis.props b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/Microsoft.Extensions.StaticAnalysis.props index 44de4c37197..2a0a63b9d32 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/Microsoft.Extensions.StaticAnalysis.props +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/Microsoft.Extensions.StaticAnalysis.props @@ -39,6 +39,6 @@ - + diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier1.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier1.globalconfig index 414718d7a21..02d2c77d2cd 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier1.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier1.globalconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:55Z +# Generated : 2023-08-07 17:59:57Z # Max Tier : 1 -# Attributes: general, general_externalonly, performance -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp +# Attributes: general, performance +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp is_global = true global_level = -1 @@ -105,6 +105,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = none +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = none + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -455,6 +460,11 @@ dotnet_diagnostic.CA1506.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1507 dotnet_diagnostic.CA1507.severity = none +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Avoid dead conditional code # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 @@ -818,23 +828,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = warning # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = warning # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = warning + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = warning + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = warning + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = warning + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1146,6 +1191,11 @@ dotnet_diagnostic.CA2259.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = none +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1641,6 +1691,66 @@ dotnet_diagnostic.CA5404.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = none +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = warning + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = warning + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = none + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = warning + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = warning + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = warning + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = warning + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = warning + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = warning + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = none + # Title : Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code # Category : Trimming dotnet_diagnostic.IL2026.severity = warning @@ -1821,7 +1931,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = none @@ -1903,155 +2013,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = warning - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = warning +dotnet_diagnostic.LA0000.severity = warning # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = warning - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = warning - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = warning - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = warning - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = warning - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = none - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = warning - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = warning - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = warning - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = warning +dotnet_diagnostic.LA0001.severity = warning # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = warning - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = warning - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = warning - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = warning - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = warning +dotnet_diagnostic.LA0002.severity = warning # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = none +dotnet_diagnostic.LA0003.severity = none # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = none +dotnet_diagnostic.LA0004.severity = none # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = none +dotnet_diagnostic.LA0005.severity = none # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = none - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = none - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = none +dotnet_diagnostic.LA0006.severity = none # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = none - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = none +dotnet_diagnostic.LA0007.severity = none # Title : Methods and properties should be named in PascalCase # Category : Minor Code Smell @@ -2808,7 +2800,8 @@ dotnet_diagnostic.S2486.severity = none # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -4061,7 +4054,7 @@ dotnet_diagnostic.S5773.severity = none # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier2.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier2.globalconfig index 4dc1978bbe0..5bbeb8f2d61 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier2.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier2.globalconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:57Z +# Generated : 2023-08-07 18:00:00Z # Max Tier : 2 -# Attributes: general, general_externalonly, performance -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp +# Attributes: general, performance +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp is_global = true global_level = -1 @@ -105,6 +105,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = warning +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = warning + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -467,6 +472,11 @@ dotnet_diagnostic.CA1507.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 dotnet_diagnostic.CA1508.severity = warning +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Invalid entry in code metrics rule specification file # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509 @@ -779,7 +789,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use R9 logging model instead +# Comment : Use the code generated model instead. dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -800,7 +810,6 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -# Redundant: R9A013 dotnet_diagnostic.CA1852.severity = none # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' @@ -831,23 +840,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = warning # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = warning # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = warning + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = warning + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = warning + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = warning + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1160,6 +1204,11 @@ dotnet_diagnostic.CA2259.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = warning +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1655,6 +1704,66 @@ dotnet_diagnostic.CA5404.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = none +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = warning + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = warning + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = none + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = warning + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = warning + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = warning + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = warning + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = warning + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = warning + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = none + # Title : Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code # Category : Trimming dotnet_diagnostic.IL2026.severity = warning @@ -1835,7 +1944,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = none @@ -1917,155 +2026,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = warning - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = warning +dotnet_diagnostic.LA0000.severity = warning # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = warning - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = warning - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = warning - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = warning - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = warning - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = none - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = warning - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = warning - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = warning - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = warning +dotnet_diagnostic.LA0001.severity = warning # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = warning - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = warning - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = warning - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = warning - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = warning +dotnet_diagnostic.LA0002.severity = warning # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = none +dotnet_diagnostic.LA0003.severity = none # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = none +dotnet_diagnostic.LA0004.severity = none # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = none +dotnet_diagnostic.LA0005.severity = none # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = none - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = none - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = none +dotnet_diagnostic.LA0006.severity = none # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = none - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = none +dotnet_diagnostic.LA0007.severity = none # Title : Methods and properties should be named in PascalCase # Category : Minor Code Smell @@ -2835,7 +2826,8 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3142,7 +3134,7 @@ dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: R9A013 +# Redundant: CA1852 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4102,7 +4094,7 @@ dotnet_diagnostic.S5773.severity = warning # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark.globalconfig index e7bd38f1756..25aa43548e3 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark.globalconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:59Z +# Generated : 2023-08-07 18:00:03Z # Max Tier : 3 -# Attributes: general, general_externalonly, performance -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp +# Attributes: general, performance +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp is_global = true global_level = -1 @@ -105,6 +105,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = warning +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = warning + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -474,6 +479,11 @@ dotnet_diagnostic.CA1507.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 dotnet_diagnostic.CA1508.severity = warning +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Invalid entry in code metrics rule specification file # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509 @@ -790,7 +800,7 @@ dotnet_diagnostic.CA1847.severity = warning # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use R9 logging model instead +# Comment : Use the code generated model instead. dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -811,7 +821,6 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -# Redundant: R9A013 dotnet_diagnostic.CA1852.severity = none # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' @@ -842,23 +851,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = warning # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = warning # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = warning + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = warning + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = warning + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = warning + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1174,6 +1218,11 @@ dotnet_diagnostic.CA2259.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = warning +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1669,6 +1718,66 @@ dotnet_diagnostic.CA5404.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = none +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = warning + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = warning + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = none + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = warning + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = warning + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = warning + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = warning + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = warning + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = warning + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = none + # Title : Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code # Category : Trimming dotnet_diagnostic.IL2026.severity = warning @@ -1849,7 +1958,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = warning @@ -1931,155 +2040,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = warning - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = warning +dotnet_diagnostic.LA0000.severity = warning # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = warning - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = warning - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = warning - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = warning - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = warning - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = none - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = warning - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = warning - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = warning - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = warning +dotnet_diagnostic.LA0001.severity = warning # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = warning - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = warning - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = warning - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = warning - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = warning +dotnet_diagnostic.LA0002.severity = warning # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = none +dotnet_diagnostic.LA0003.severity = none # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = none +dotnet_diagnostic.LA0004.severity = none # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = none +dotnet_diagnostic.LA0005.severity = none # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = none - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = none - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = none +dotnet_diagnostic.LA0006.severity = none # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = none - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = none +dotnet_diagnostic.LA0007.severity = none # Title : Methods and properties should be named in PascalCase # Category : Minor Code Smell @@ -2855,7 +2846,8 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3164,7 +3156,7 @@ dotnet_diagnostic.S3257.severity = warning # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: R9A013 +# Redundant: CA1852 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4128,7 +4120,7 @@ dotnet_diagnostic.S5773.severity = warning # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier1.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier1.globalconfig index 2db1c9dd6f5..4e356778751 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier1.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier1.globalconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:53Z +# Generated : 2023-08-07 17:59:55Z # Max Tier : 1 -# Attributes: general, general_externalonly -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp +# Attributes: general +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp is_global = true global_level = -1 @@ -105,6 +105,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = none +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = none + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -455,6 +460,11 @@ dotnet_diagnostic.CA1506.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1507 dotnet_diagnostic.CA1507.severity = none +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Avoid dead conditional code # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 @@ -818,23 +828,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = none # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = none # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = none + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = none + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = suggestion + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1146,6 +1191,11 @@ dotnet_diagnostic.CA2259.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = none +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1641,6 +1691,66 @@ dotnet_diagnostic.CA5404.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = none +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = none + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = none + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = none + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = none + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = none + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = none + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = none + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = none + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = none + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = none + # Title : Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code # Category : Trimming dotnet_diagnostic.IL2026.severity = warning @@ -1821,7 +1931,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = none @@ -1903,155 +2013,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = none - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = none +dotnet_diagnostic.LA0000.severity = none # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = none - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = none - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = none - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = none - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = none - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = none - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = warning - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = none - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = none - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = none +dotnet_diagnostic.LA0001.severity = none # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = none - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = none - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = none - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = none - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = none +dotnet_diagnostic.LA0002.severity = none # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = none +dotnet_diagnostic.LA0003.severity = none # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = none +dotnet_diagnostic.LA0004.severity = none # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = none +dotnet_diagnostic.LA0005.severity = none # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = none - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = none - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = none +dotnet_diagnostic.LA0006.severity = none # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = none - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = none +dotnet_diagnostic.LA0007.severity = none # Title : Methods and properties should be named in PascalCase # Category : Minor Code Smell @@ -2808,7 +2800,8 @@ dotnet_diagnostic.S2486.severity = none # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -4061,7 +4054,7 @@ dotnet_diagnostic.S5773.severity = none # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier2.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier2.globalconfig index ee483c2b795..968f7486e87 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier2.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier2.globalconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:55Z +# Generated : 2023-08-07 17:59:58Z # Max Tier : 2 -# Attributes: general, general_externalonly -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp +# Attributes: general +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp is_global = true global_level = -1 @@ -105,6 +105,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = warning +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = warning + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -467,6 +472,11 @@ dotnet_diagnostic.CA1507.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 dotnet_diagnostic.CA1508.severity = warning +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Invalid entry in code metrics rule specification file # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509 @@ -779,7 +789,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use R9 logging model instead +# Comment : Use the code generated model instead. dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -800,7 +810,6 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -# Redundant: R9A013 dotnet_diagnostic.CA1852.severity = none # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' @@ -831,23 +840,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = none # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = none # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = none + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = none + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = suggestion + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1160,6 +1204,11 @@ dotnet_diagnostic.CA2259.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = warning +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1655,6 +1704,66 @@ dotnet_diagnostic.CA5404.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = none +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = none + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = none + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = none + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = none + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = none + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = none + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = none + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = none + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = none + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = none + # Title : Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code # Category : Trimming dotnet_diagnostic.IL2026.severity = warning @@ -1835,7 +1944,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = none @@ -1917,155 +2026,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = none - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = none +dotnet_diagnostic.LA0000.severity = none # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = none - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = none - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = none - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = none - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = none - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = none - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = warning - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = none - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = none - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = none +dotnet_diagnostic.LA0001.severity = none # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = none - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = none - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = none - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = none - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = none +dotnet_diagnostic.LA0002.severity = none # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = none +dotnet_diagnostic.LA0003.severity = none # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = none +dotnet_diagnostic.LA0004.severity = none # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = none +dotnet_diagnostic.LA0005.severity = none # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = none - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = none - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = none +dotnet_diagnostic.LA0006.severity = none # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = none - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = none +dotnet_diagnostic.LA0007.severity = none # Title : Methods and properties should be named in PascalCase # Category : Minor Code Smell @@ -2835,7 +2826,8 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3142,7 +3134,7 @@ dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: R9A013 +# Redundant: CA1852 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4102,7 +4094,7 @@ dotnet_diagnostic.S5773.severity = warning # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General.globalconfig index e42ab780b90..178caa96120 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General.globalconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:58Z +# Generated : 2023-08-07 18:00:01Z # Max Tier : 3 -# Attributes: general, general_externalonly -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp +# Attributes: general +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp is_global = true global_level = -1 @@ -105,6 +105,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = warning +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = warning + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -472,6 +477,11 @@ dotnet_diagnostic.CA1507.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 dotnet_diagnostic.CA1508.severity = warning +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Invalid entry in code metrics rule specification file # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509 @@ -788,7 +798,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use R9 logging model instead +# Comment : Use the code generated model instead. dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -809,7 +819,6 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -# Redundant: R9A013 dotnet_diagnostic.CA1852.severity = none # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' @@ -840,23 +849,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = none # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = none # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = none + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = none + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = suggestion + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1172,6 +1216,11 @@ dotnet_diagnostic.CA2259.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = warning +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1667,6 +1716,66 @@ dotnet_diagnostic.CA5404.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = none +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = none + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = none + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = none + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = none + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = none + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = none + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = none + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = none + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = none + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = none + # Title : Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code # Category : Trimming dotnet_diagnostic.IL2026.severity = warning @@ -1847,7 +1956,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = warning @@ -1929,155 +2038,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = none - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = none +dotnet_diagnostic.LA0000.severity = none # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = none - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = none - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = none - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = none - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = none - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = none - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = warning - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = none - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = none - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = none +dotnet_diagnostic.LA0001.severity = none # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = none - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = none - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = none - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = none - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = none +dotnet_diagnostic.LA0002.severity = none # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = none +dotnet_diagnostic.LA0003.severity = none # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = none +dotnet_diagnostic.LA0004.severity = none # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = none +dotnet_diagnostic.LA0005.severity = none # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = none - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = none - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = none +dotnet_diagnostic.LA0006.severity = none # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = none - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = none +dotnet_diagnostic.LA0007.severity = none # Title : Methods and properties should be named in PascalCase # Category : Minor Code Smell @@ -2853,7 +2844,8 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3162,7 +3154,7 @@ dotnet_diagnostic.S3257.severity = warning # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: R9A013 +# Redundant: CA1852 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4126,7 +4118,7 @@ dotnet_diagnostic.S5773.severity = warning # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier1.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier1.globalconfig index 8d7e5e5ab6b..a0b2414f06b 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier1.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier1.globalconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:54Z +# Generated : 2023-08-07 17:59:56Z # Max Tier : 1 -# Attributes: general, general_externalonly -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp +# Attributes: general +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp is_global = true global_level = -1 @@ -105,6 +105,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = none +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = none + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -455,6 +460,11 @@ dotnet_diagnostic.CA1506.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1507 dotnet_diagnostic.CA1507.severity = none +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Avoid dead conditional code # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 @@ -818,23 +828,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = none # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = none # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = none + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = none + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = suggestion + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1146,6 +1191,11 @@ dotnet_diagnostic.CA2259.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = none +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1641,6 +1691,66 @@ dotnet_diagnostic.CA5404.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = none +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = none + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = none + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = none + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = none + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = none + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = none + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = none + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = none + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = none + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = none + # Title : Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code # Category : Trimming dotnet_diagnostic.IL2026.severity = warning @@ -1821,7 +1931,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = none @@ -1903,155 +2013,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = none - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = none +dotnet_diagnostic.LA0000.severity = none # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = none - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = none - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = none - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = none - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = none - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = none - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = warning - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = none - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = none - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = none +dotnet_diagnostic.LA0001.severity = none # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = none - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = none - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = none - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = none - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = none +dotnet_diagnostic.LA0002.severity = none # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = none +dotnet_diagnostic.LA0003.severity = none # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = none +dotnet_diagnostic.LA0004.severity = none # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = none +dotnet_diagnostic.LA0005.severity = none # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = none - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = none - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = none +dotnet_diagnostic.LA0006.severity = none # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = none - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = none +dotnet_diagnostic.LA0007.severity = none # Title : Methods and properties should be named in PascalCase # Category : Minor Code Smell @@ -2808,7 +2800,8 @@ dotnet_diagnostic.S2486.severity = none # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -4061,7 +4054,7 @@ dotnet_diagnostic.S5773.severity = none # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier2.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier2.globalconfig index 5bcdeeed35d..6585728bcd9 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier2.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier2.globalconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:56Z +# Generated : 2023-08-07 17:59:59Z # Max Tier : 2 -# Attributes: general, general_externalonly -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp +# Attributes: general +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp is_global = true global_level = -1 @@ -105,6 +105,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = warning +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = warning + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -467,6 +472,11 @@ dotnet_diagnostic.CA1507.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 dotnet_diagnostic.CA1508.severity = warning +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Invalid entry in code metrics rule specification file # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509 @@ -779,7 +789,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use R9 logging model instead +# Comment : Use the code generated model instead. dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -800,7 +810,6 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -# Redundant: R9A013 dotnet_diagnostic.CA1852.severity = none # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' @@ -831,23 +840,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = none # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = none # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = none + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = none + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = suggestion + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1160,6 +1204,11 @@ dotnet_diagnostic.CA2259.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = warning +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1655,6 +1704,66 @@ dotnet_diagnostic.CA5404.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = none +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = none + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = none + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = none + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = none + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = none + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = none + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = none + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = none + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = none + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = none + # Title : Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code # Category : Trimming dotnet_diagnostic.IL2026.severity = warning @@ -1835,7 +1944,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = none @@ -1917,155 +2026,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = none - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = none +dotnet_diagnostic.LA0000.severity = none # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = none - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = none - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = none - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = none - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = none - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = none - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = warning - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = none - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = none - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = none +dotnet_diagnostic.LA0001.severity = none # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = none - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = none - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = none - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = none - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = none +dotnet_diagnostic.LA0002.severity = none # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = none +dotnet_diagnostic.LA0003.severity = none # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = none +dotnet_diagnostic.LA0004.severity = none # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = none +dotnet_diagnostic.LA0005.severity = none # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = none - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = none - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = none +dotnet_diagnostic.LA0006.severity = none # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = none - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = none +dotnet_diagnostic.LA0007.severity = none # Title : Methods and properties should be named in PascalCase # Category : Minor Code Smell @@ -2835,7 +2826,8 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3142,7 +3134,7 @@ dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: R9A013 +# Redundant: CA1852 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4102,7 +4094,7 @@ dotnet_diagnostic.S5773.severity = warning # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe.globalconfig index 077966a7580..7ae55d22c4d 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe.globalconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:59Z +# Generated : 2023-08-07 18:00:02Z # Max Tier : 3 -# Attributes: general, general_externalonly -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp +# Attributes: general +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp is_global = true global_level = -1 @@ -105,6 +105,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = warning +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = warning + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -472,6 +477,11 @@ dotnet_diagnostic.CA1507.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 dotnet_diagnostic.CA1508.severity = warning +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Invalid entry in code metrics rule specification file # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509 @@ -788,7 +798,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use R9 logging model instead +# Comment : Use the code generated model instead. dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -809,7 +819,6 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -# Redundant: R9A013 dotnet_diagnostic.CA1852.severity = none # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' @@ -840,23 +849,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = none # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = none # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = none + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = none + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = suggestion + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1172,6 +1216,11 @@ dotnet_diagnostic.CA2259.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = warning +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1667,6 +1716,66 @@ dotnet_diagnostic.CA5404.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = none +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = none + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = none + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = none + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = none + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = none + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = none + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = none + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = none + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = none + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = none + # Title : Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code # Category : Trimming dotnet_diagnostic.IL2026.severity = warning @@ -1847,7 +1956,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = warning @@ -1929,155 +2038,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = none - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = none +dotnet_diagnostic.LA0000.severity = none # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = none - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = none - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = none - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = none - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = none - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = none - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = warning - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = none - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = none - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = none +dotnet_diagnostic.LA0001.severity = none # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = none - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = none - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = none - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = none - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = none +dotnet_diagnostic.LA0002.severity = none # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = none +dotnet_diagnostic.LA0003.severity = none # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = none +dotnet_diagnostic.LA0004.severity = none # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = none +dotnet_diagnostic.LA0005.severity = none # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = none - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = none - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = none +dotnet_diagnostic.LA0006.severity = none # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = none - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = none +dotnet_diagnostic.LA0007.severity = none # Title : Methods and properties should be named in PascalCase # Category : Minor Code Smell @@ -2853,7 +2844,8 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3162,7 +3154,7 @@ dotnet_diagnostic.S3257.severity = warning # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: R9A013 +# Redundant: CA1852 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4126,7 +4118,7 @@ dotnet_diagnostic.S5773.severity = warning # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier1.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier1.globalconfig index 600f02cc637..9cbbbf453e6 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier1.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier1.globalconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:54Z +# Generated : 2023-08-07 17:59:57Z # Max Tier : 1 -# Attributes: api, general, general_externalonly -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp +# Attributes: api, general +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp is_global = true global_level = -1 @@ -105,6 +105,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = none +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = none + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -455,6 +460,11 @@ dotnet_diagnostic.CA1506.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1507 dotnet_diagnostic.CA1507.severity = none +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Avoid dead conditional code # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 @@ -818,23 +828,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = none # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = none # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = none + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = none + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = suggestion + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1146,6 +1191,11 @@ dotnet_diagnostic.CA2259.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = none +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1641,6 +1691,66 @@ dotnet_diagnostic.CA5404.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = none +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = none + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = none + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = none + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = none + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = none + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = none + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = none + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = none + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = none + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = none + # Title : Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code # Category : Trimming dotnet_diagnostic.IL2026.severity = warning @@ -1821,7 +1931,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = none @@ -1903,155 +2013,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = none - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = none +dotnet_diagnostic.LA0000.severity = none # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = none - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = none - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = none - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = none - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = none - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = none - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = warning - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = none - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = none - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = none +dotnet_diagnostic.LA0001.severity = none # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = none - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = none - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = none - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = none - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = none +dotnet_diagnostic.LA0002.severity = none # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = warning +dotnet_diagnostic.LA0003.severity = warning # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = warning +dotnet_diagnostic.LA0004.severity = warning # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = warning +dotnet_diagnostic.LA0005.severity = warning # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = warning - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = warning - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = warning +dotnet_diagnostic.LA0006.severity = warning # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = warning - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = none +dotnet_diagnostic.LA0007.severity = warning # Title : Methods and properties should be named in PascalCase # Category : Minor Code Smell @@ -2808,7 +2800,8 @@ dotnet_diagnostic.S2486.severity = none # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -4061,7 +4054,7 @@ dotnet_diagnostic.S5773.severity = none # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier2.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier2.globalconfig index b3dda2ffe55..1d30b171ac0 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier2.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier2.globalconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:57Z +# Generated : 2023-08-07 18:00:00Z # Max Tier : 2 -# Attributes: api, general, general_externalonly -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp +# Attributes: api, general +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp is_global = true global_level = -1 @@ -105,6 +105,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = warning +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = warning + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -475,6 +480,11 @@ dotnet_diagnostic.CA1507.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 dotnet_diagnostic.CA1508.severity = warning +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Invalid entry in code metrics rule specification file # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509 @@ -787,7 +797,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use R9 logging model instead +# Comment : Use the code generated model instead. dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -808,7 +818,6 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -# Redundant: R9A013 dotnet_diagnostic.CA1852.severity = none # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' @@ -839,23 +848,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = none # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = none # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = none + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = none + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = suggestion + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1170,6 +1214,11 @@ dotnet_diagnostic.CA2259.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = warning +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1665,6 +1714,66 @@ dotnet_diagnostic.CA5404.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = none +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = none + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = none + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = none + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = none + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = none + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = none + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = none + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = none + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = none + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = none + # Title : Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code # Category : Trimming dotnet_diagnostic.IL2026.severity = warning @@ -1845,7 +1954,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = none @@ -1927,155 +2036,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = none - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = none +dotnet_diagnostic.LA0000.severity = none # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = none - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = none - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = none - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = none - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = none - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = none - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = warning - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = none - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = none - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = none +dotnet_diagnostic.LA0001.severity = none # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = none - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = none - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = none - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = none - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = none +dotnet_diagnostic.LA0002.severity = none # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = warning +dotnet_diagnostic.LA0003.severity = warning # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = warning +dotnet_diagnostic.LA0004.severity = warning # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = warning +dotnet_diagnostic.LA0005.severity = warning # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = warning - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = warning - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = warning +dotnet_diagnostic.LA0006.severity = warning # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = warning - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = none +dotnet_diagnostic.LA0007.severity = warning # Title : Methods and properties should be named in PascalCase # Category : Minor Code Smell @@ -2845,7 +2836,8 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3152,7 +3144,7 @@ dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: R9A013 +# Redundant: CA1852 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4112,7 +4104,7 @@ dotnet_diagnostic.S5773.severity = warning # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib.globalconfig index 519c50bc10d..f46a61748bc 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib.globalconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:59Z +# Generated : 2023-08-07 18:00:03Z # Max Tier : 3 -# Attributes: api, general, general_externalonly -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp +# Attributes: api, general +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp is_global = true global_level = -1 @@ -106,6 +106,11 @@ dotnet_code_quality.CA1000.api_surface = public # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = warning +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = warning + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -488,6 +493,11 @@ dotnet_diagnostic.CA1507.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 dotnet_diagnostic.CA1508.severity = warning +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Invalid entry in code metrics rule specification file # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509 @@ -811,7 +821,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use R9 logging model instead +# Comment : Use the code generated model instead. dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -832,7 +842,6 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -# Redundant: R9A013 dotnet_diagnostic.CA1852.severity = none # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' @@ -863,23 +872,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = none # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = none # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = none + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = none + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = suggestion + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1197,6 +1241,11 @@ dotnet_diagnostic.CA2259.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = warning +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1692,6 +1741,66 @@ dotnet_diagnostic.CA5404.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = none +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = none + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = none + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = none + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = none + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = none + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = none + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = none + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = none + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = none + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = none + # Title : Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code # Category : Trimming dotnet_diagnostic.IL2026.severity = warning @@ -1872,7 +1981,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = warning @@ -1954,155 +2063,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = none - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = none +dotnet_diagnostic.LA0000.severity = none # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = none - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = none - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = none - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = none - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = none - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = none - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = warning - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = none - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = none - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = none +dotnet_diagnostic.LA0001.severity = none # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = none - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = none - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = none - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = none - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = none +dotnet_diagnostic.LA0002.severity = none # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = warning +dotnet_diagnostic.LA0003.severity = warning # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = warning +dotnet_diagnostic.LA0004.severity = warning # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = warning +dotnet_diagnostic.LA0005.severity = warning # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = warning - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = warning - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = warning +dotnet_diagnostic.LA0006.severity = warning # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = warning - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = none +dotnet_diagnostic.LA0007.severity = warning # Title : Methods and properties should be named in PascalCase # Category : Minor Code Smell @@ -2878,7 +2869,8 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3187,7 +3179,7 @@ dotnet_diagnostic.S3257.severity = warning # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: R9A013 +# Redundant: CA1852 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4151,7 +4143,7 @@ dotnet_diagnostic.S5773.severity = warning # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier1.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier1.globalconfig index 28c396b275b..04addb3b03a 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier1.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier1.globalconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:53Z +# Generated : 2023-08-07 17:59:55Z # Max Tier : 1 -# Attributes: general, general_externalonly, performance, production -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp +# Attributes: general, performance, production +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp is_global = true global_level = -1 @@ -105,6 +105,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = none +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = none + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -455,6 +460,11 @@ dotnet_diagnostic.CA1506.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1507 dotnet_diagnostic.CA1507.severity = none +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Avoid dead conditional code # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 @@ -818,23 +828,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = warning # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = warning # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = warning + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = warning + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = warning + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = warning + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1146,6 +1191,11 @@ dotnet_diagnostic.CA2259.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = none +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1641,6 +1691,66 @@ dotnet_diagnostic.CA5404.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = warning +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = warning + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = warning + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = warning + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = warning + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = warning + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = warning + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = warning + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = warning + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = warning + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = warning + # Title : Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code # Category : Trimming dotnet_diagnostic.IL2026.severity = warning @@ -1821,7 +1931,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = none @@ -1903,155 +2013,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = warning - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = warning +dotnet_diagnostic.LA0000.severity = warning # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = warning - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = warning - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = warning - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = warning - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = warning - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = warning - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = warning - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = warning - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = warning - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = warning +dotnet_diagnostic.LA0001.severity = warning # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = warning - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = warning - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = warning - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = warning - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = warning +dotnet_diagnostic.LA0002.severity = warning # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = none +dotnet_diagnostic.LA0003.severity = none # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = none +dotnet_diagnostic.LA0004.severity = none # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = none +dotnet_diagnostic.LA0005.severity = none # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = none - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = none - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = none +dotnet_diagnostic.LA0006.severity = none # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = none - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = warning +dotnet_diagnostic.LA0007.severity = none # Title : Methods and properties should be named in PascalCase # Category : Minor Code Smell @@ -2808,7 +2800,8 @@ dotnet_diagnostic.S2486.severity = none # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -4061,7 +4054,7 @@ dotnet_diagnostic.S5773.severity = none # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier2.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier2.globalconfig index c04d340fc57..73d00708e8b 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier2.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier2.globalconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:56Z +# Generated : 2023-08-07 17:59:58Z # Max Tier : 2 -# Attributes: general, general_externalonly, performance, production -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp +# Attributes: general, performance, production +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp is_global = true global_level = -1 @@ -105,6 +105,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = warning +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = warning + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -468,6 +473,11 @@ dotnet_diagnostic.CA1507.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 dotnet_diagnostic.CA1508.severity = warning +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Invalid entry in code metrics rule specification file # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509 @@ -780,7 +790,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use R9 logging model instead +# Comment : Use the code generated model instead. dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -801,7 +811,6 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -# Redundant: R9A013 dotnet_diagnostic.CA1852.severity = none # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' @@ -832,23 +841,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = warning # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = warning # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = warning + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = warning + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = warning + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = warning + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1161,6 +1205,11 @@ dotnet_diagnostic.CA2259.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = warning +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1656,6 +1705,66 @@ dotnet_diagnostic.CA5404.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = warning +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = warning + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = warning + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = warning + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = warning + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = warning + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = warning + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = warning + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = warning + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = warning + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = warning + # Title : Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code # Category : Trimming dotnet_diagnostic.IL2026.severity = warning @@ -1836,7 +1945,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = none @@ -1918,155 +2027,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = warning - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = warning +dotnet_diagnostic.LA0000.severity = warning # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = warning - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = warning - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = warning - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = warning - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = warning - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = warning - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = warning - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = warning - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = warning - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = warning +dotnet_diagnostic.LA0001.severity = warning # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = warning - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = warning - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = warning - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = warning - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = warning +dotnet_diagnostic.LA0002.severity = warning # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = none +dotnet_diagnostic.LA0003.severity = none # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = none +dotnet_diagnostic.LA0004.severity = none # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = none +dotnet_diagnostic.LA0005.severity = none # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = none - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = none - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = none +dotnet_diagnostic.LA0006.severity = none # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = none - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = warning +dotnet_diagnostic.LA0007.severity = none # Title : Methods and properties should be named in PascalCase # Category : Minor Code Smell @@ -2836,7 +2827,8 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3143,7 +3135,7 @@ dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: R9A013 +# Redundant: CA1852 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4103,7 +4095,7 @@ dotnet_diagnostic.S5773.severity = warning # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe.globalconfig index 97788d9c506..09f9a5c5d7f 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe.globalconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:58Z +# Generated : 2023-08-07 18:00:02Z # Max Tier : 3 -# Attributes: general, general_externalonly, performance, production -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp +# Attributes: general, performance, production +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp is_global = true global_level = -1 @@ -105,6 +105,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = warning +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = warning + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -475,6 +480,11 @@ dotnet_diagnostic.CA1507.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 dotnet_diagnostic.CA1508.severity = warning +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Invalid entry in code metrics rule specification file # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509 @@ -791,7 +801,7 @@ dotnet_diagnostic.CA1847.severity = warning # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use R9 logging model instead +# Comment : Use the code generated model instead. dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -812,7 +822,6 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -# Redundant: R9A013 dotnet_diagnostic.CA1852.severity = none # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' @@ -843,23 +852,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = warning # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = warning # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = warning + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = warning + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = warning + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = warning + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1175,6 +1219,11 @@ dotnet_diagnostic.CA2259.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = warning +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1670,6 +1719,66 @@ dotnet_diagnostic.CA5404.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = warning +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = warning + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = warning + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = warning + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = warning + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = warning + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = warning + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = warning + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = warning + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = warning + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = warning + # Title : Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code # Category : Trimming dotnet_diagnostic.IL2026.severity = warning @@ -1850,7 +1959,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = warning @@ -1932,155 +2041,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = warning - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = warning +dotnet_diagnostic.LA0000.severity = warning # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = warning - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = warning - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = warning - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = warning - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = warning - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = warning - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = warning - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = warning - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = warning - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = warning +dotnet_diagnostic.LA0001.severity = warning # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = warning - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = warning - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = warning - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = warning - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = warning +dotnet_diagnostic.LA0002.severity = warning # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = none +dotnet_diagnostic.LA0003.severity = none # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = none +dotnet_diagnostic.LA0004.severity = none # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = none +dotnet_diagnostic.LA0005.severity = none # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = none - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = none - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = none +dotnet_diagnostic.LA0006.severity = none # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = none - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = warning +dotnet_diagnostic.LA0007.severity = none # Title : Methods and properties should be named in PascalCase # Category : Minor Code Smell @@ -2856,7 +2847,8 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3165,7 +3157,7 @@ dotnet_diagnostic.S3257.severity = warning # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: R9A013 +# Redundant: CA1852 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4129,7 +4121,7 @@ dotnet_diagnostic.S5773.severity = warning # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier1.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier1.globalconfig index 3156c68232f..61e0d68d5a4 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier1.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier1.globalconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:54Z +# Generated : 2023-08-07 17:59:56Z # Max Tier : 1 -# Attributes: api, general, general_externalonly, performance, production -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp +# Attributes: api, general, performance, production +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp is_global = true global_level = -1 @@ -105,6 +105,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = none +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = none + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -455,6 +460,11 @@ dotnet_diagnostic.CA1506.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1507 dotnet_diagnostic.CA1507.severity = none +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Avoid dead conditional code # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 @@ -818,23 +828,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = warning # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = warning # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = warning + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = warning + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = warning + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = warning + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1146,6 +1191,11 @@ dotnet_diagnostic.CA2259.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = none +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1641,6 +1691,66 @@ dotnet_diagnostic.CA5404.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = warning +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = warning + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = warning + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = warning + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = warning + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = warning + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = warning + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = warning + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = warning + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = warning + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = warning + # Title : Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code # Category : Trimming dotnet_diagnostic.IL2026.severity = warning @@ -1821,7 +1931,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = none @@ -1903,155 +2013,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = warning - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = warning +dotnet_diagnostic.LA0000.severity = warning # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = warning - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = warning - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = warning - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = warning - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = warning - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = warning - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = warning - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = warning - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = warning - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = warning +dotnet_diagnostic.LA0001.severity = warning # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = warning - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = warning - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = warning - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = warning - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = warning +dotnet_diagnostic.LA0002.severity = warning # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = warning +dotnet_diagnostic.LA0003.severity = warning # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = warning +dotnet_diagnostic.LA0004.severity = warning # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = warning +dotnet_diagnostic.LA0005.severity = warning # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = warning - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = warning - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = warning +dotnet_diagnostic.LA0006.severity = warning # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = warning - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = warning +dotnet_diagnostic.LA0007.severity = warning # Title : Methods and properties should be named in PascalCase # Category : Minor Code Smell @@ -2808,7 +2800,8 @@ dotnet_diagnostic.S2486.severity = none # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -4061,7 +4054,7 @@ dotnet_diagnostic.S5773.severity = none # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier2.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier2.globalconfig index a4b2a824a9f..d9fab7efe87 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier2.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier2.globalconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:56Z +# Generated : 2023-08-07 17:59:59Z # Max Tier : 2 -# Attributes: api, general, general_externalonly, performance, production -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp +# Attributes: api, general, performance, production +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp is_global = true global_level = -1 @@ -105,6 +105,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = warning +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = warning + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -475,6 +480,11 @@ dotnet_diagnostic.CA1507.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 dotnet_diagnostic.CA1508.severity = warning +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Invalid entry in code metrics rule specification file # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509 @@ -787,7 +797,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use R9 logging model instead +# Comment : Use the code generated model instead. dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -808,7 +818,6 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -# Redundant: R9A013 dotnet_diagnostic.CA1852.severity = none # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' @@ -839,23 +848,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = warning # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = warning # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = warning + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = warning + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = warning + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = warning + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1170,6 +1214,11 @@ dotnet_diagnostic.CA2259.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = warning +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1665,6 +1714,66 @@ dotnet_diagnostic.CA5404.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = warning +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = warning + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = warning + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = warning + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = warning + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = warning + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = warning + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = warning + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = warning + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = warning + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = warning + # Title : Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code # Category : Trimming dotnet_diagnostic.IL2026.severity = warning @@ -1845,7 +1954,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = none @@ -1927,155 +2036,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = warning - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = warning +dotnet_diagnostic.LA0000.severity = warning # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = warning - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = warning - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = warning - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = warning - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = warning - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = warning - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = warning - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = warning - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = warning - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = warning +dotnet_diagnostic.LA0001.severity = warning # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = warning - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = warning - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = warning - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = warning - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = warning +dotnet_diagnostic.LA0002.severity = warning # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = warning +dotnet_diagnostic.LA0003.severity = warning # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = warning +dotnet_diagnostic.LA0004.severity = warning # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = warning +dotnet_diagnostic.LA0005.severity = warning # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = warning - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = warning - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = warning +dotnet_diagnostic.LA0006.severity = warning # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = warning - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = warning +dotnet_diagnostic.LA0007.severity = warning # Title : Methods and properties should be named in PascalCase # Category : Minor Code Smell @@ -2845,7 +2836,8 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3152,7 +3144,7 @@ dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: R9A013 +# Redundant: CA1852 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4112,7 +4104,7 @@ dotnet_diagnostic.S5773.severity = warning # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib.globalconfig index 3eb1c0c96e5..c9baa40edb3 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib.globalconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:58Z +# Generated : 2023-08-07 18:00:02Z # Max Tier : 3 -# Attributes: api, general, general_externalonly, performance, production -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp +# Attributes: api, general, performance, production +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp is_global = true global_level = -1 @@ -106,6 +106,11 @@ dotnet_code_quality.CA1000.api_surface = public # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = warning +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = warning + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -488,6 +493,11 @@ dotnet_diagnostic.CA1507.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 dotnet_diagnostic.CA1508.severity = warning +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Invalid entry in code metrics rule specification file # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509 @@ -811,7 +821,7 @@ dotnet_diagnostic.CA1847.severity = warning # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use R9 logging model instead +# Comment : Use the code generated model instead. dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -832,7 +842,6 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -# Redundant: R9A013 dotnet_diagnostic.CA1852.severity = none # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' @@ -863,23 +872,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = warning # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = warning # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = warning + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = warning + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = warning + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = warning + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1197,6 +1241,11 @@ dotnet_diagnostic.CA2259.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = warning +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1692,6 +1741,66 @@ dotnet_diagnostic.CA5404.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = warning +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = warning + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = warning + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = warning + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = warning + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = warning + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = warning + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = warning + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = warning + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = warning + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = warning + # Title : Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code # Category : Trimming dotnet_diagnostic.IL2026.severity = warning @@ -1872,7 +1981,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = warning @@ -1954,155 +2063,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = warning - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = warning +dotnet_diagnostic.LA0000.severity = warning # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = warning - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = warning - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = warning - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = warning - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = warning - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = warning - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = warning - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = warning - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = warning - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = warning +dotnet_diagnostic.LA0001.severity = warning # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = warning - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = warning - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = warning - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = warning - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = warning +dotnet_diagnostic.LA0002.severity = warning # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = warning +dotnet_diagnostic.LA0003.severity = warning # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = warning +dotnet_diagnostic.LA0004.severity = warning # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = warning +dotnet_diagnostic.LA0005.severity = warning # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = warning - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = warning - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = warning +dotnet_diagnostic.LA0006.severity = warning # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = warning - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = warning +dotnet_diagnostic.LA0007.severity = warning # Title : Methods and properties should be named in PascalCase # Category : Minor Code Smell @@ -2878,7 +2869,8 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3187,7 +3179,7 @@ dotnet_diagnostic.S3257.severity = warning # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: R9A013 +# Redundant: CA1852 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4151,7 +4143,7 @@ dotnet_diagnostic.S5773.severity = warning # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier1.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier1.globalconfig index f0f49e61831..270925f2358 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier1.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier1.globalconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:55Z +# Generated : 2023-08-07 17:59:58Z # Max Tier : 1 -# Attributes: general, general_externalonly, test -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, xunit.analyzers +# Attributes: general, test +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, xunit.analyzers is_global = true global_level = -1 @@ -105,6 +105,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = none +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = none + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -455,6 +460,11 @@ dotnet_diagnostic.CA1506.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1507 dotnet_diagnostic.CA1507.severity = none +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Avoid dead conditional code # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 @@ -818,23 +828,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = none # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = none # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = none + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = none + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = suggestion + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1146,6 +1191,11 @@ dotnet_diagnostic.CA2259.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = none +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1641,6 +1691,66 @@ dotnet_diagnostic.CA5404.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = none +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = none + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = none + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = none + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = none + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = none + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = none + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = none + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = none + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = none + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = none + # Title : Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code # Category : Trimming dotnet_diagnostic.IL2026.severity = warning @@ -1821,7 +1931,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = none @@ -1903,155 +2013,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = none - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = none +dotnet_diagnostic.LA0000.severity = none # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = none - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = none - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = none - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = none - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = none - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = none - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = warning - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = none - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = none - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = none +dotnet_diagnostic.LA0001.severity = none # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = none - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = none - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = none - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = none - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = none +dotnet_diagnostic.LA0002.severity = none # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = none +dotnet_diagnostic.LA0003.severity = none # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = none +dotnet_diagnostic.LA0004.severity = none # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = none +dotnet_diagnostic.LA0005.severity = none # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = none - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = none - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = none +dotnet_diagnostic.LA0006.severity = none # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = none - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = none +dotnet_diagnostic.LA0007.severity = none # Title : Methods and properties should be named in PascalCase # Category : Minor Code Smell @@ -2808,7 +2800,8 @@ dotnet_diagnostic.S2486.severity = none # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -4061,7 +4054,7 @@ dotnet_diagnostic.S5773.severity = none # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier2.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier2.globalconfig index f5805871467..2f718a5050a 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier2.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier2.globalconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:57Z +# Generated : 2023-08-07 18:00:01Z # Max Tier : 2 -# Attributes: general, general_externalonly, test -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, xunit.analyzers +# Attributes: general, test +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, xunit.analyzers is_global = true global_level = -1 @@ -105,6 +105,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = warning +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = warning + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -467,6 +472,11 @@ dotnet_diagnostic.CA1507.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 dotnet_diagnostic.CA1508.severity = warning +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Invalid entry in code metrics rule specification file # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509 @@ -779,7 +789,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use R9 logging model instead +# Comment : Use the code generated model instead. dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -800,7 +810,6 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -# Redundant: R9A013 dotnet_diagnostic.CA1852.severity = none # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' @@ -831,23 +840,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = none # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = none # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = none + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = none + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = suggestion + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1160,6 +1204,11 @@ dotnet_diagnostic.CA2259.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = warning +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1655,6 +1704,66 @@ dotnet_diagnostic.CA5404.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = none +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = none + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = none + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = none + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = none + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = none + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = none + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = none + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = none + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = none + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = none + # Title : Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code # Category : Trimming dotnet_diagnostic.IL2026.severity = warning @@ -1835,7 +1944,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = none @@ -1917,155 +2026,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = none - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = none +dotnet_diagnostic.LA0000.severity = none # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = none - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = none - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = none - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = none - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = none - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = none - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = warning - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = none - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = none - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = none +dotnet_diagnostic.LA0001.severity = none # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = none - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = none - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = none - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = none - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = none +dotnet_diagnostic.LA0002.severity = none # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = none +dotnet_diagnostic.LA0003.severity = none # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = none +dotnet_diagnostic.LA0004.severity = none # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = none +dotnet_diagnostic.LA0005.severity = none # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = none - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = none - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = none +dotnet_diagnostic.LA0006.severity = none # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = none - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = none +dotnet_diagnostic.LA0007.severity = none # Title : Methods and properties should be named in PascalCase # Category : Minor Code Smell @@ -2835,7 +2826,8 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3142,7 +3134,7 @@ dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: R9A013 +# Redundant: CA1852 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4102,7 +4094,7 @@ dotnet_diagnostic.S5773.severity = warning # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test.globalconfig index 2f263a25e75..3fdc2ccce2a 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test.globalconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:59Z +# Generated : 2023-08-07 18:00:04Z # Max Tier : 3 -# Attributes: general, general_externalonly, test -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, xunit.analyzers +# Attributes: general, test +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, xunit.analyzers is_global = true global_level = -1 @@ -105,6 +105,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = warning +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = warning + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -472,6 +477,11 @@ dotnet_diagnostic.CA1507.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 dotnet_diagnostic.CA1508.severity = warning +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Invalid entry in code metrics rule specification file # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509 @@ -788,7 +798,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use R9 logging model instead +# Comment : Use the code generated model instead. dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -809,7 +819,6 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -# Redundant: R9A013 dotnet_diagnostic.CA1852.severity = none # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' @@ -840,23 +849,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = none # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = none # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = none + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = none + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = suggestion + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1172,6 +1216,11 @@ dotnet_diagnostic.CA2259.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = warning +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1667,6 +1716,66 @@ dotnet_diagnostic.CA5404.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = none +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = none + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = none + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = none + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = none + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = none + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = none + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = none + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = none + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = none + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = none + # Title : Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code # Category : Trimming dotnet_diagnostic.IL2026.severity = warning @@ -1847,7 +1956,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = warning @@ -1929,155 +2038,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = none - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = none +dotnet_diagnostic.LA0000.severity = none # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = none - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = none - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = none - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = none - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = none - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = none - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = warning - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = none - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = none - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = none +dotnet_diagnostic.LA0001.severity = none # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = none - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = none - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = none - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = none - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = none +dotnet_diagnostic.LA0002.severity = none # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = none +dotnet_diagnostic.LA0003.severity = none # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = none +dotnet_diagnostic.LA0004.severity = none # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = none +dotnet_diagnostic.LA0005.severity = none # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = none - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = none - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = none +dotnet_diagnostic.LA0006.severity = none # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = none - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = none +dotnet_diagnostic.LA0007.severity = none # Title : Methods and properties should be named in PascalCase # Category : Minor Code Smell @@ -2853,7 +2844,8 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3162,7 +3154,7 @@ dotnet_diagnostic.S3257.severity = warning # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: R9A013 +# Redundant: CA1852 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4126,7 +4118,7 @@ dotnet_diagnostic.S5773.severity = warning # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Shared/.editorconfig b/src/Shared/.editorconfig index 3b8a95063f5..3c94c92dbfd 100644 --- a/src/Shared/.editorconfig +++ b/src/Shared/.editorconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:52Z +# Generated : 2023-08-07 17:59:53Z # Max Tier : 2147483647 # Attributes: general, performance, production -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers [*.cs] @@ -104,6 +104,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = warning +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = warning + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -474,6 +479,11 @@ dotnet_diagnostic.CA1507.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 dotnet_diagnostic.CA1508.severity = warning +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Invalid entry in code metrics rule specification file # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509 @@ -791,7 +801,7 @@ dotnet_diagnostic.CA1847.severity = warning # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use R9 logging model instead +# Comment : Use the code generated model instead. dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -812,7 +822,6 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -# Redundant: R9A013 dotnet_diagnostic.CA1852.severity = none # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' @@ -843,23 +852,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = warning # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = warning # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = warning + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = warning + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = warning + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = warning + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1175,6 +1219,11 @@ dotnet_diagnostic.CA2259.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = warning +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1670,6 +1719,66 @@ dotnet_diagnostic.CA5404.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = warning +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = warning + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = warning + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = warning + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = warning + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = warning + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = warning + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = warning + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = warning + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = warning + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = warning + # Title : Set MSBuild property 'GenerateDocumentationFile' to 'true' # Category : Style # Help Link: https://github.com/dotnet/roslyn/issues/41640 @@ -1968,7 +2077,7 @@ dotnet_diagnostic.IDE0051.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0052 dotnet_diagnostic.IDE0052.severity = warning -# Title : Use block body for lambda expression +# Title : Use expression body for lambda expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0053 # Comment : This metadata was entered manually, since it is not exposed in the normal way from the analyzer assembly. @@ -2107,7 +2216,7 @@ dotnet_style_prefer_simplified_interpolation = true # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0072 dotnet_diagnostic.IDE0072.severity = silent -# Title : The file header does not match the required text +# Title : The file header is missing or not located at the top of the file # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0073 dotnet_diagnostic.IDE0073.severity = warning @@ -2286,6 +2395,21 @@ dotnet_diagnostic.IDE0270.severity = silent # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0280 dotnet_diagnostic.IDE0280.severity = silent +# Title : Use primary constructor +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0290 +dotnet_diagnostic.IDE0290.severity = none + +# Title : Simplify collection initialization +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0300 +dotnet_diagnostic.IDE0300.severity = none + +# Title : Simplify collection initialization +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0301 +dotnet_diagnostic.IDE0301.severity = suggestion + # Title : Delegate invocation can be simplified. # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1005 @@ -2587,7 +2711,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = warning @@ -2669,155 +2793,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = warning - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = warning +dotnet_diagnostic.LA0000.severity = warning # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = warning - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = warning - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = warning - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = warning - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = warning - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = warning - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = none - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = warning - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = warning - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = warning +dotnet_diagnostic.LA0001.severity = warning # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = warning - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = warning - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = warning - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = warning - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = warning +dotnet_diagnostic.LA0002.severity = warning # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = none +dotnet_diagnostic.LA0003.severity = none # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = none +dotnet_diagnostic.LA0004.severity = none # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = none +dotnet_diagnostic.LA0005.severity = none # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = none - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = none - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = none +dotnet_diagnostic.LA0006.severity = none # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = none - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = warning +dotnet_diagnostic.LA0007.severity = none # Title : # Category : Style @@ -3597,7 +3603,8 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3906,7 +3913,7 @@ dotnet_diagnostic.S3257.severity = warning # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: R9A013 +# Redundant: CA1852 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4870,7 +4877,7 @@ dotnet_diagnostic.S5773.severity = warning # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/src/Shared/NumericExtensions/NumericExtensions.cs b/src/Shared/NumericExtensions/NumericExtensions.cs index 3fff74b193c..c904dc36b5c 100644 --- a/src/Shared/NumericExtensions/NumericExtensions.cs +++ b/src/Shared/NumericExtensions/NumericExtensions.cs @@ -7,7 +7,7 @@ namespace Microsoft.Shared.Text; #pragma warning restore CA1716 -#pragma warning disable R9A036 // this is the implementation of ToInvariantString, so this warning doesn't make sense here +#pragma warning disable LA0002 // this is the implementation of ToInvariantString, so this warning doesn't make sense here /// /// Utilities to augment the basic numeric types. diff --git a/src/Shared/Pools/PoolFactory.cs b/src/Shared/Pools/PoolFactory.cs index a742ddfffaa..b3ecebea5ce 100644 --- a/src/Shared/Pools/PoolFactory.cs +++ b/src/Shared/Pools/PoolFactory.cs @@ -10,8 +10,6 @@ #pragma warning disable CA1716 namespace Microsoft.Shared.Pools; -#pragma warning disable R9A038 - /// /// A factory of object pools. /// diff --git a/src/ToBeRemoved/.editorconfig b/src/ToBeRemoved/.editorconfig index 627a654267f..2054f20b775 100644 --- a/src/ToBeRemoved/.editorconfig +++ b/src/ToBeRemoved/.editorconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:51Z +# Generated : 2023-08-07 17:59:52Z # Max Tier : 2147483647 # Attributes: general, performance, production -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers [*.cs] @@ -104,6 +104,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = warning +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = warning + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -474,6 +479,11 @@ dotnet_diagnostic.CA1507.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 dotnet_diagnostic.CA1508.severity = warning +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Invalid entry in code metrics rule specification file # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509 @@ -791,7 +801,7 @@ dotnet_diagnostic.CA1847.severity = warning # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use R9 logging model instead +# Comment : Use the code generated model instead. dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -812,7 +822,6 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -# Redundant: R9A013 dotnet_diagnostic.CA1852.severity = none # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' @@ -843,23 +852,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = warning # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = warning # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = warning + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = warning + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = warning + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = warning + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1175,6 +1219,11 @@ dotnet_diagnostic.CA2259.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = warning +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1670,6 +1719,66 @@ dotnet_diagnostic.CA5404.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = warning +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = warning + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = warning + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = warning + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = warning + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = warning + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = warning + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = warning + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = warning + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = warning + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = warning + # Title : Set MSBuild property 'GenerateDocumentationFile' to 'true' # Category : Style # Help Link: https://github.com/dotnet/roslyn/issues/41640 @@ -1968,7 +2077,7 @@ dotnet_diagnostic.IDE0051.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0052 dotnet_diagnostic.IDE0052.severity = warning -# Title : Use block body for lambda expression +# Title : Use expression body for lambda expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0053 # Comment : This metadata was entered manually, since it is not exposed in the normal way from the analyzer assembly. @@ -2107,7 +2216,7 @@ dotnet_style_prefer_simplified_interpolation = true # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0072 dotnet_diagnostic.IDE0072.severity = silent -# Title : The file header does not match the required text +# Title : The file header is missing or not located at the top of the file # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0073 dotnet_diagnostic.IDE0073.severity = warning @@ -2286,6 +2395,21 @@ dotnet_diagnostic.IDE0270.severity = silent # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0280 dotnet_diagnostic.IDE0280.severity = silent +# Title : Use primary constructor +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0290 +dotnet_diagnostic.IDE0290.severity = none + +# Title : Simplify collection initialization +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0300 +dotnet_diagnostic.IDE0300.severity = none + +# Title : Simplify collection initialization +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0301 +dotnet_diagnostic.IDE0301.severity = suggestion + # Title : Delegate invocation can be simplified. # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1005 @@ -2587,7 +2711,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = warning @@ -2669,155 +2793,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = warning - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = warning +dotnet_diagnostic.LA0000.severity = warning # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = warning - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = warning - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = warning - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = warning - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = warning - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = warning - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = none - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = warning - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = warning - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = warning +dotnet_diagnostic.LA0001.severity = warning # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = warning - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = warning - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = warning - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = warning - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = warning +dotnet_diagnostic.LA0002.severity = warning # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = none +dotnet_diagnostic.LA0003.severity = none # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = none +dotnet_diagnostic.LA0004.severity = none # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = none +dotnet_diagnostic.LA0005.severity = none # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = none - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = none - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = none +dotnet_diagnostic.LA0006.severity = none # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = none - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = warning +dotnet_diagnostic.LA0007.severity = none # Title : # Category : Style @@ -3597,7 +3603,8 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3906,7 +3913,7 @@ dotnet_diagnostic.S3257.severity = warning # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: R9A013 +# Redundant: CA1852 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4870,7 +4877,7 @@ dotnet_diagnostic.S5773.severity = warning # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/test/.editorconfig b/test/.editorconfig index 3921320ffb3..7036f224f95 100644 --- a/test/.editorconfig +++ b/test/.editorconfig @@ -1,8 +1,8 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-05-24 21:09:53Z +# Generated : 2023-08-07 17:59:54Z # Max Tier : 2147483647 # Attributes: general, test -# Analyzers : ILLink.RoslynAnalyzer, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.Extensions.ExtraAnalyzers.Roslyn4.0, Microsoft.Extensions.LocalAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers, xunit.analyzers +# Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers, xunit.analyzers [*.cs] @@ -104,6 +104,11 @@ dotnet_diagnostic.CA1000.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 dotnet_diagnostic.CA1001.severity = warning +# Title : Types that own disposable fields should be disposable +# Category : Design +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 +dotnet_diagnostic.CA1001.severity = warning + # Title : Do not expose generic lists # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002 @@ -471,6 +476,11 @@ dotnet_diagnostic.CA1507.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 dotnet_diagnostic.CA1508.severity = warning +# Title : Avoid dead conditional code +# Category : Maintainability +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1508 +dotnet_diagnostic.CA1508.severity = warning + # Title : Invalid entry in code metrics rule specification file # Category : Maintainability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1509 @@ -788,7 +798,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use R9 logging model instead +# Comment : Use the code generated model instead. dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -809,7 +819,6 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -# Redundant: R9A013 dotnet_diagnostic.CA1852.severity = none # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' @@ -840,23 +849,58 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = suggestion +dotnet_diagnostic.CA1858.severity = none # Title : Use concrete types when possible for improved performance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 -dotnet_diagnostic.CA1859.severity = suggestion +dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = suggestion +dotnet_diagnostic.CA1860.severity = none # Title : Avoid constant arrays as arguments # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861 dotnet_diagnostic.CA1861.severity = suggestion +# Title : Prefer using 'StringComparer' to perform case-insensitive string comparisons +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 +dotnet_diagnostic.CA1862.severity = none + +# Title : Use 'CompositeFormat' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 +dotnet_diagnostic.CA1863.severity = none + +# Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 +dotnet_diagnostic.CA1864.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1865 +dotnet_diagnostic.CA1865.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1866 +dotnet_diagnostic.CA1866.severity = suggestion + +# Title : Use char overload +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1867 +dotnet_diagnostic.CA1867.severity = warning + +# Title : Unnecessary call to 'Contains(item)' +# Category : Performance +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 +dotnet_diagnostic.CA1868.severity = suggestion + # Title : Dispose objects before losing scope # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2000 @@ -1172,6 +1216,11 @@ dotnet_diagnostic.CA2259.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2260 dotnet_diagnostic.CA2260.severity = warning +# Title : Do not use ConfigureAwaitOptions.SuppressThrowing with Task +# Category : Usage +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 +dotnet_diagnostic.CA2261.severity = warning + # Title : Do not use insecure deserializer BinaryFormatter # Category : Security # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2300 @@ -1667,6 +1716,66 @@ dotnet_diagnostic.CA5404.severity = none # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca5405 dotnet_diagnostic.CA5405.severity = none +# Title : Use source generated logging methods for improved performance +# Category : Performance +dotnet_diagnostic.EA0000.severity = none + +# Title : Perform message formatting in the body of the logging method +# Category : Performance +dotnet_diagnostic.EA0001.severity = none + +# Title : Use 'System.TimeProvider' to make the code easier to test +# Category : Reliability +dotnet_diagnostic.EA0002.severity = none + +# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' +# Category : Performance +dotnet_diagnostic.EA0003.severity = none + +# Title : Make types declared in an executable internal +# Category : Performance +dotnet_diagnostic.EA0004.severity = none + +# Title : Consider using an array instead of a collection +# Category : Performance +dotnet_diagnostic.EA0005.severity = none + +# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance +# Category : Performance +dotnet_diagnostic.EA0006.severity = none + +# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance +# Category : Performance +dotnet_diagnostic.EA0007.severity = none + +# Title : Use generic collections instead of legacy collections for improved performance +# Category : Performance +dotnet_diagnostic.EA0008.severity = none + +# Title : Use 'System.MemoryExtensions.Split' for improved performance +# Category : Performance +dotnet_diagnostic.EA0009.severity = none + +# Title : Fire-and-forget async call inside a 'using' block +# Category : Correctness +dotnet_diagnostic.EA0010.severity = warning + +# Title : Consider removing unnecessary conditional access operator (?) +# Category : Performance +dotnet_diagnostic.EA0011.severity = warning + +# Title : Consider removing unnecessary null coalescing assignment (??=) +# Category : Performance +dotnet_diagnostic.EA0012.severity = suggestion + +# Title : Consider removing unnecessary null coalescing operator (??) +# Category : Performance +dotnet_diagnostic.EA0013.severity = suggestion + +# Title : The async method doesn't support cancellation +# Category : Resilience +dotnet_diagnostic.EA0014.severity = none + # Title : Set MSBuild property 'GenerateDocumentationFile' to 'true' # Category : Style # Help Link: https://github.com/dotnet/roslyn/issues/41640 @@ -1965,7 +2074,7 @@ dotnet_diagnostic.IDE0051.severity = warning # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0052 dotnet_diagnostic.IDE0052.severity = warning -# Title : Use block body for lambda expression +# Title : Use expression body for lambda expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0053 # Comment : This metadata was entered manually, since it is not exposed in the normal way from the analyzer assembly. @@ -2103,7 +2212,7 @@ dotnet_style_prefer_simplified_interpolation = true # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0072 dotnet_diagnostic.IDE0072.severity = silent -# Title : The file header does not match the required text +# Title : The file header is missing or not located at the top of the file # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0073 dotnet_diagnostic.IDE0073.severity = warning @@ -2282,6 +2391,21 @@ dotnet_diagnostic.IDE0270.severity = silent # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0280 dotnet_diagnostic.IDE0280.severity = silent +# Title : Use primary constructor +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0290 +dotnet_diagnostic.IDE0290.severity = none + +# Title : Simplify collection initialization +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0300 +dotnet_diagnostic.IDE0300.severity = none + +# Title : Simplify collection initialization +# Category : Style +# Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0301 +dotnet_diagnostic.IDE0301.severity = suggestion + # Title : Delegate invocation can be simplified. # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1005 @@ -2583,7 +2707,7 @@ dotnet_diagnostic.IL2094.severity = warning # Category : Trimming dotnet_diagnostic.IL2095.severity = warning -# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently ILLink can not guarantee presence of all the matching types. +# Title : Call to 'Type.GetType' method can perform case insensitive lookup of the type, currently trimming can not guarantee presence of all the matching types. # Category : Trimming dotnet_diagnostic.IL2096.severity = warning @@ -2665,155 +2789,37 @@ dotnet_diagnostic.IL3051.severity = warning # Category : AOT dotnet_diagnostic.IL3056.severity = warning -# Title : Use source generated logging methods for improved performance -# Category : Performance -# Help Link: https://TODO/r9a000 -dotnet_diagnostic.R9A000.severity = none - # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a014 -dotnet_diagnostic.R9A014.severity = none +dotnet_diagnostic.LA0000.severity = none # Title : Use the 'Microsoft.Shared.Diagnostics.Throws' class instead of explicitly throwing exception for improved performance # Category : Performance -# Help Link: https://TODO/r9a015 -dotnet_diagnostic.R9A015.severity = none - -# Title : Use 'System.Text.CompositeFormat' instead of 'string.Format' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a018 -dotnet_diagnostic.R9A018.severity = none - -# Title : Remove unnecessary dictionary lookups -# Category : Performance -# Help Link: https://TODO/r9a019 -dotnet_diagnostic.R9A019.severity = none - -# Title : Remove unnecessary set lookups -# Category : Performance -# Help Link: https://TODO/r9a020 -dotnet_diagnostic.R9A020.severity = none - -# Title : Perform message formatting in the body of the logging method -# Category : Performance -# Help Link: https://TODO/r9a021 -dotnet_diagnostic.R9A021.severity = none - -# Title : Use 'System.TimeProvider' to make the code easier to test -# Category : Reliability -# Help Link: https://TODO/r9a022 -dotnet_diagnostic.R9A022.severity = none - -# Title : Using experimental API -# Category : Reliability -# Help Link: https://TODO/r9a029 -dotnet_diagnostic.R9A029.severity = none - -# Title : Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' -# Category : Performance -# Help Link: https://TODO/r9a030 -dotnet_diagnostic.R9A030.severity = none - -# Title : Make types declared in an executable internal -# Category : Performance -# Help Link: https://TODO/r9a031 -dotnet_diagnostic.R9A031.severity = none - -# Title : Consider using an array instead of a collection -# Category : Performance -# Help Link: https://TODO/r9a032 -dotnet_diagnostic.R9A032.severity = none - -# Title : Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a033 -dotnet_diagnostic.R9A033.severity = none +dotnet_diagnostic.LA0001.severity = none # Title : Use 'Microsoft.Shared.Text.NumericExtensions.ToInvariantString' for improved performance # Category : Performance -# Help Link: https://TODO/r9a036 -dotnet_diagnostic.R9A036.severity = none - -# Title : Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a037 -dotnet_diagnostic.R9A037.severity = none - -# Title : Use generic collections instead of legacy collections for improved performance -# Category : Performance -# Help Link: https://TODO/r9a040 -dotnet_diagnostic.R9A040.severity = none - -# Title : Use 'System.MemoryExtensions.Split' for improved performance -# Category : Performance -# Help Link: https://TODO/r9a043 -dotnet_diagnostic.R9A043.severity = none - -# Title : Assign array of literal values to a static field for improved performance -# Category : Performance -# Help Link: https://TODO/r9a044 -dotnet_diagnostic.R9A044.severity = none +dotnet_diagnostic.LA0002.severity = none # Title : Newly added symbols must be marked as experimental # Category : Correctness -# Help Link: https://TODO/r9a049 -dotnet_diagnostic.R9A049.severity = none +dotnet_diagnostic.LA0003.severity = none # Title : Experimental symbols cannot be marked as obsolete # Category : Correctness -# Help Link: https://TODO/r9a050 -dotnet_diagnostic.R9A050.severity = none +dotnet_diagnostic.LA0004.severity = none # Title : Published symbols cannot be marked experimental # Category : Correctness -# Help Link: https://TODO/r9a051 -dotnet_diagnostic.R9A051.severity = none +dotnet_diagnostic.LA0005.severity = none # Title : Published symbols cannot be deleted to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a052 -dotnet_diagnostic.R9A052.severity = none - -# Title : A deprecated API is not annotated with the obsolete attribute -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a053 -dotnet_diagnostic.R9A053.severity = none - -# Title : A deprecated API is marked as experimental -# Category : Correctness -# Help Link: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis/analyzers/r9a054 -dotnet_diagnostic.R9A054.severity = none +dotnet_diagnostic.LA0006.severity = none # Title : Published symbols cannot be changed to maintain compatibility # Category : Correctness -# Help Link: https://TODO/r9a055 -dotnet_diagnostic.R9A055.severity = none - -# Title : Fire-and-forget async call inside a 'using' block -# Category : Correctness -# Help Link: https://TODO/r9a056 -dotnet_diagnostic.R9A056.severity = warning - -# Title : Consider removing unnecessary conditional access operator (?) -# Category : Performance -# Help Link: https://TODO/r9a058 -dotnet_diagnostic.R9A058.severity = suggestion - -# Title : Consider removing unnecessary null coalescing assignment (??=) -# Category : Performance -# Help Link: https://TODO/r9a059 -dotnet_diagnostic.R9A059.severity = suggestion - -# Title : Consider removing unnecessary null coalescing operator (??) -# Category : Performance -# Help Link: https://TODO/r9a060 -dotnet_diagnostic.R9A060.severity = suggestion - -# Title : The async method doesn't support cancellation -# Category : Resilience -# Help Link: https://TODO/r9a061 -dotnet_diagnostic.R9A061.severity = none +dotnet_diagnostic.LA0007.severity = none # Title : # Category : Style @@ -3593,7 +3599,8 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -dotnet_diagnostic.S2551.severity = warning +# Redundant: CA2002 +dotnet_diagnostic.S2551.severity = none # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3902,7 +3909,7 @@ dotnet_diagnostic.S3257.severity = warning # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: R9A013 +# Redundant: CA1852 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4866,7 +4873,7 @@ dotnet_diagnostic.S5773.severity = warning # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: R9A022 +# Redundant: EA0002 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless diff --git a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/StaticTimeTests.cs b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/StaticTimeTests.cs index 2cb147a2215..807e097aedc 100644 --- a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/StaticTimeTests.cs +++ b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/StaticTimeTests.cs @@ -24,8 +24,6 @@ public static class StaticTimeTests public static async Task StaticTime() { const string Source = @" - #pragma warning disable R9A017 - using System; using System.Threading; using System.Threading.Tasks; diff --git a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/MakeExeTypesInternalTests.cs b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/MakeExeTypesInternalTests.cs index 3d66b4b9064..204d3e83e69 100644 --- a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/MakeExeTypesInternalTests.cs +++ b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/MakeExeTypesInternalTests.cs @@ -79,7 +79,7 @@ internal class Test4 public static async Task Disqualification() { const string Source = @" -#pragma warning disable R9A031 +#pragma warning disable EA0004 namespace Xunit { public sealed class FactAttribute : System.Attribute {} @@ -102,8 +102,8 @@ namespace MessagePack [System.AttributeUsage(System.AttributeTargets.Class)] public sealed class MessagePackObjectAttribute : System.Attribute {} } +#pragma warning restore EA0004 -#pragma warning restore R9A031 namespace Example { using Xunit; diff --git a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/SyntaxNodeExtensionsTests.cs b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/SyntaxNodeExtensionsTests.cs index cbf1561b6ff..dffff9b0933 100644 --- a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/SyntaxNodeExtensionsTests.cs +++ b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/SyntaxNodeExtensionsTests.cs @@ -188,7 +188,7 @@ public void GetExpressionName_WithMemberAccessExpression() var memberaccess = SyntaxFactory.MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, console, writeline); var expression = SyntaxFactory.InvocationExpression(memberaccess, SyntaxFactory.ArgumentList()); - Assert.Equal(writeline.ToString(), expression?.GetExpressionName()?.ToString()); + Assert.Equal(writeline.ToString(), expression.GetExpressionName()?.ToString()); } [Fact] @@ -198,6 +198,6 @@ public void GetExpressionName_WithMemberBindingExpression() var memberbind = SyntaxFactory.MemberBindingExpression(SyntaxFactory.ParseToken("."), b); var expression = SyntaxFactory.InvocationExpression(memberbind); - Assert.Equal(b.ToString(), expression?.GetExpressionName()?.ToString()); + Assert.Equal(b.ToString(), expression.GetExpressionName()?.ToString()); } } diff --git a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/UsingToStringInLoggersTests.cs b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/UsingToStringInLoggersTests.cs index 20872070b04..00c3c135a20 100644 --- a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/UsingToStringInLoggersTests.cs +++ b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/UsingToStringInLoggersTests.cs @@ -95,7 +95,7 @@ internal sealed class SimpleAttribute : Attribute internal static class Log { - [Simple(""This method is not a R9 LogMethod and should be ignored."")] + [Simple(""This method is not a LogMethod and should be ignored."")] public static void Trace(ILogger log, string arg) { log.LogTrace(arg); diff --git a/test/Generators/Microsoft.Gen.Logging/TestClasses/ExceptionTestExtensions.cs b/test/Generators/Microsoft.Gen.Logging/TestClasses/ExceptionTestExtensions.cs index cca3a0cca0e..caf3f48e762 100644 --- a/test/Generators/Microsoft.Gen.Logging/TestClasses/ExceptionTestExtensions.cs +++ b/test/Generators/Microsoft.Gen.Logging/TestClasses/ExceptionTestExtensions.cs @@ -15,10 +15,10 @@ internal static partial class ExceptionTestExtensions [LogMethod(1, LogLevel.Debug, "M1 {ex2}")] public static partial void M1(Exception ex1, ILogger logger, Exception ex2); -#pragma warning disable R9G012 // Don't include a template for ex in the logging message +#pragma warning disable LOGGEN009 // Don't include a template for ex in the logging message [LogMethod(2, LogLevel.Debug, "M2 {arg1}: {ex}")] public static partial void M2(ILogger logger, string arg1, Exception ex); -#pragma warning restore R9G012 +#pragma warning restore LOGGEN009 [LogMethod] public static partial void M3(Exception ex, ILogger logger, LogLevel level); diff --git a/test/Generators/Microsoft.Gen.Logging/TestClasses/LevelTestExtensions.cs b/test/Generators/Microsoft.Gen.Logging/TestClasses/LevelTestExtensions.cs index ef948c3306a..badde762a91 100644 --- a/test/Generators/Microsoft.Gen.Logging/TestClasses/LevelTestExtensions.cs +++ b/test/Generators/Microsoft.Gen.Logging/TestClasses/LevelTestExtensions.cs @@ -38,14 +38,14 @@ internal static partial class LevelTestExtensions [LogMethod(9, "M9")] public static partial void M9(LogLevel level, ILogger logger); -#pragma warning disable R9G001 // Don't include a template for level in the logging message +#pragma warning disable LOGGEN000 // Don't include a template for level in the logging message [LogMethod(10, "M10 {level}")] public static partial void M10(ILogger logger, LogLevel level); -#pragma warning restore R9G001 +#pragma warning restore LOGGEN000 -#pragma warning disable R9G017 // Don't include a template for logger in the logging message +#pragma warning disable LOGGEN014 // Don't include a template for logger in the logging message [LogMethod(11, "M11 {logger}")] public static partial void M11(ILogger logger, LogLevel level); -#pragma warning restore R9G017 +#pragma warning restore LOGGEN014 } } diff --git a/test/Generators/Microsoft.Gen.Logging/TestClasses/MessageTestExtensions.cs b/test/Generators/Microsoft.Gen.Logging/TestClasses/MessageTestExtensions.cs index 2ef3d07dac1..f4be74fd005 100644 --- a/test/Generators/Microsoft.Gen.Logging/TestClasses/MessageTestExtensions.cs +++ b/test/Generators/Microsoft.Gen.Logging/TestClasses/MessageTestExtensions.cs @@ -18,8 +18,6 @@ internal static partial class MessageTestExtensions public static partial void M2(ILogger logger); #if false -#pragma warning disable R9G014 -#pragma warning disable R9G005 // These are disabled due to https://github.com/dotnet/roslyn/issues/52527 // @@ -35,9 +33,6 @@ internal static partial class MessageTestExtensions [LogMethod(4, LogLevel.Debug, "{p1}")] public static partial void M4(ILogger logger, string p1, int p2, int p3); -#pragma warning restore R9G014 -#pragma warning restore R9G005 - #endif [LogMethod(5, LogLevel.Debug, "\"Hello\" World")] diff --git a/test/Generators/Microsoft.Gen.Logging/TestClasses/TagProviderExtensions.cs b/test/Generators/Microsoft.Gen.Logging/TestClasses/TagProviderExtensions.cs index 59f5478aa04..18bd6929907 100644 --- a/test/Generators/Microsoft.Gen.Logging/TestClasses/TagProviderExtensions.cs +++ b/test/Generators/Microsoft.Gen.Logging/TestClasses/TagProviderExtensions.cs @@ -61,7 +61,7 @@ public static void ProvideProperties(ITagCollector list, ClassToLog? param) public static void ProvideOtherProperties(ITagCollector list, ClassToLog? param) { - list.Add("Another_property_name", param?.MyStringProperty?.ToUpperInvariant()); + list.Add("Another_property_name", param?.MyStringProperty.ToUpperInvariant()); list.Add(nameof(ClassToLog.MyIntProperty) + "_test", param?.MyIntProperty); } diff --git a/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.LogProperties.cs b/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.LogProperties.cs index 72eaadf0e4e..3a884f0b17e 100644 --- a/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.LogProperties.cs +++ b/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.LogProperties.cs @@ -64,7 +64,7 @@ partial class C [InlineData("System.Exception")] public async Task LogPropertiesInvalidUsage(string annotation) { - // We don't check [LogProperties] on ILogger here since it produces a lot of errors apart from R9G027 + // We don't check [LogProperties] on ILogger here since it produces a lot of errors string source = @$" partial class C {{ diff --git a/test/Generators/Microsoft.Gen.Metering/TestClasses/AttributedWithoutNamespace.cs b/test/Generators/Microsoft.Gen.Metering/TestClasses/AttributedWithoutNamespace.cs index cb0cac517a4..cd38f1a66be 100644 --- a/test/Generators/Microsoft.Gen.Metering/TestClasses/AttributedWithoutNamespace.cs +++ b/test/Generators/Microsoft.Gen.Metering/TestClasses/AttributedWithoutNamespace.cs @@ -7,8 +7,6 @@ [SuppressMessage("Usage", "CA1801:Review unused parameters", Justification = "For testing emitter for classes without namespace")] -[SuppressMessage("Readability", "R9A046:Source generated metrics (fast metrics) should be located in 'Metric' class", - Justification = "Metering generator tests")] internal static partial class InstrumentsWithoutNamespace { [Counter] diff --git a/test/Generators/Microsoft.Gen.Metering/TestClasses/CounterTestExtensions.cs b/test/Generators/Microsoft.Gen.Metering/TestClasses/CounterTestExtensions.cs index 209b7091808..28ec66076f3 100644 --- a/test/Generators/Microsoft.Gen.Metering/TestClasses/CounterTestExtensions.cs +++ b/test/Generators/Microsoft.Gen.Metering/TestClasses/CounterTestExtensions.cs @@ -1,14 +1,11 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Diagnostics.CodeAnalysis; using System.Diagnostics.Metrics; using Microsoft.Extensions.Telemetry.Metering; namespace TestClasses { - [SuppressMessage("Readability", "R9A046:Source generated metrics (fast metrics) should be located in 'Metric' class", - Justification = "Metering generator tests")] internal static partial class CounterTestExtensions { [Counter] diff --git a/test/Generators/Microsoft.Gen.Metering/TestClasses/FileScopedNamespaceExtensions.cs b/test/Generators/Microsoft.Gen.Metering/TestClasses/FileScopedNamespaceExtensions.cs index 3ff34cc95e6..49d6e41f4d4 100644 --- a/test/Generators/Microsoft.Gen.Metering/TestClasses/FileScopedNamespaceExtensions.cs +++ b/test/Generators/Microsoft.Gen.Metering/TestClasses/FileScopedNamespaceExtensions.cs @@ -1,14 +1,11 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Diagnostics.CodeAnalysis; using System.Diagnostics.Metrics; using Microsoft.Extensions.Telemetry.Metering; namespace TestClasses; -[SuppressMessage("Readability", "R9A046:Source generated metrics (fast metrics) should be located in 'Metric' class", - Justification = "Metering generator tests")] internal static partial class FileScopedExtensions { [Counter] diff --git a/test/Generators/Microsoft.Gen.Metering/TestClasses/HistogramTestExtensions.cs b/test/Generators/Microsoft.Gen.Metering/TestClasses/HistogramTestExtensions.cs index ef1a6305dc4..8616c806521 100644 --- a/test/Generators/Microsoft.Gen.Metering/TestClasses/HistogramTestExtensions.cs +++ b/test/Generators/Microsoft.Gen.Metering/TestClasses/HistogramTestExtensions.cs @@ -9,8 +9,6 @@ namespace TestClasses { [SuppressMessage("Usage", "CA1801:Review unused parameters", Justification = "Method body is source generated where the parameters will be used")] - [SuppressMessage("Readability", "R9A046:Source generated metrics (fast metrics) should be located in 'Metric' class", - Justification = "Metering generator tests")] internal static partial class HistogramTestExtensions { [Histogram] diff --git a/test/Generators/Microsoft.Gen.Metering/TestClasses/MeterTExtensions.cs b/test/Generators/Microsoft.Gen.Metering/TestClasses/MeterTExtensions.cs index 12afe494bd3..694890a2591 100644 --- a/test/Generators/Microsoft.Gen.Metering/TestClasses/MeterTExtensions.cs +++ b/test/Generators/Microsoft.Gen.Metering/TestClasses/MeterTExtensions.cs @@ -1,13 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.Telemetry.Metering; namespace TestClasses { - [SuppressMessage("Readability", "R9A046:Source generated metrics (fast metrics) should be located in 'Metric' class", - Justification = "Metering generator tests")] internal static partial class MeterTExtensions { internal sealed class DummyType diff --git a/test/Generators/Microsoft.Gen.Metering/TestClasses/NestedClassMetrics.cs b/test/Generators/Microsoft.Gen.Metering/TestClasses/NestedClassMetrics.cs index 298c6ada543..8cf26744f73 100644 --- a/test/Generators/Microsoft.Gen.Metering/TestClasses/NestedClassMetrics.cs +++ b/test/Generators/Microsoft.Gen.Metering/TestClasses/NestedClassMetrics.cs @@ -9,8 +9,6 @@ namespace NestedClass.Metering { [SuppressMessage("Usage", "CA1801:Review unused parameters", Justification = "For testing emitter for classes")] - [SuppressMessage("Readability", "R9A046:Source generated metrics (fast metrics) should be located in 'Metric' class", - Justification = "Metering generator tests")] public static partial class TopLevelClass { internal static partial class InstrumentsInNestedClass diff --git a/test/Generators/Microsoft.Gen.Metering/TestClasses/NestedRecordClassMetrics.cs b/test/Generators/Microsoft.Gen.Metering/TestClasses/NestedRecordClassMetrics.cs index 5c0bd77eab5..6a4903cb79a 100644 --- a/test/Generators/Microsoft.Gen.Metering/TestClasses/NestedRecordClassMetrics.cs +++ b/test/Generators/Microsoft.Gen.Metering/TestClasses/NestedRecordClassMetrics.cs @@ -9,8 +9,6 @@ namespace NestedRecordClass.Metering { [SuppressMessage("Usage", "CA1801:Review unused parameters", Justification = "For testing emitter for records")] - [SuppressMessage("Readability", "R9A046:Source generated metrics (fast metrics) should be located in 'Metric' class", - Justification = "Metering generator tests")] public static partial class TopLevelRecordClass { public partial record class InstrumentsInNestedRecordClass(string Address) diff --git a/test/Generators/Microsoft.Gen.Metering/TestClasses/NestedRecordStructMetrics.cs b/test/Generators/Microsoft.Gen.Metering/TestClasses/NestedRecordStructMetrics.cs index d7947a03327..5df153f8183 100644 --- a/test/Generators/Microsoft.Gen.Metering/TestClasses/NestedRecordStructMetrics.cs +++ b/test/Generators/Microsoft.Gen.Metering/TestClasses/NestedRecordStructMetrics.cs @@ -9,8 +9,6 @@ namespace NestedRecordStruct.Metering { [SuppressMessage("Usage", "CA1801:Review unused parameters", Justification = "For testing emitter for structs")] - [SuppressMessage("Readability", "R9A046:Source generated metrics (fast metrics) should be located in 'Metric' class", - Justification = "Metering generator tests")] public static partial class TopLevelStructClass { public partial record struct InstrumentsInNestedRecordStruct(string Address) diff --git a/test/Generators/Microsoft.Gen.Metering/TestClasses/NestedStructMetrics.cs b/test/Generators/Microsoft.Gen.Metering/TestClasses/NestedStructMetrics.cs index 4de1b0ee4a5..26fa182e2ff 100644 --- a/test/Generators/Microsoft.Gen.Metering/TestClasses/NestedStructMetrics.cs +++ b/test/Generators/Microsoft.Gen.Metering/TestClasses/NestedStructMetrics.cs @@ -9,8 +9,6 @@ namespace NestedStruct.Metering { [SuppressMessage("Usage", "CA1801:Review unused parameters", Justification = "For testing emitter for classes")] - [SuppressMessage("Readability", "R9A046:Source generated metrics (fast metrics) should be located in 'Metric' class", - Justification = "Metering generator tests")] public partial struct TopLevelStruct { internal partial struct InstrumentsInNestedStruct diff --git a/test/Generators/Microsoft.Gen.Metering/TestClasses/OverlappingNamesTestExtensions.cs b/test/Generators/Microsoft.Gen.Metering/TestClasses/OverlappingNamesTestExtensions.cs index a3e4fe2d3d7..7c7a5513fa4 100644 --- a/test/Generators/Microsoft.Gen.Metering/TestClasses/OverlappingNamesTestExtensions.cs +++ b/test/Generators/Microsoft.Gen.Metering/TestClasses/OverlappingNamesTestExtensions.cs @@ -11,8 +11,6 @@ namespace TestClassesNspace.Metering { [SuppressMessage("Usage", "CA1801:Review unused parameters", Justification = "Method body is source generated where the parameters will be used")] - [SuppressMessage("Readability", "R9A046:Source generated metrics (fast metrics) should be located in 'Metric' class", - Justification = "Metering generator tests")] public static partial class OverlappingNamesTestExtensions { [Counter(typeof(StrongTypeDimensionsOverlappingNames))] diff --git a/test/Generators/Microsoft.Gen.Metering/TestClasses/Public.cs b/test/Generators/Microsoft.Gen.Metering/TestClasses/Public.cs index 92b19ca2b40..563f9dedab8 100644 --- a/test/Generators/Microsoft.Gen.Metering/TestClasses/Public.cs +++ b/test/Generators/Microsoft.Gen.Metering/TestClasses/Public.cs @@ -9,8 +9,6 @@ namespace PublicMetering { [SuppressMessage("Usage", "CA1801:Review unused parameters", Justification = "For testing emitter for classes without namespace")] - [SuppressMessage("Readability", "R9A046:Source generated metrics (fast metrics) should be located in 'Metric' class", - Justification = "Metering generator tests")] public static partial class PublicMetricInstruments { [Counter] diff --git a/test/Generators/Microsoft.Gen.MeteringReports/TestClasses/MeterAttributedWithXmlDescriptions.cs b/test/Generators/Microsoft.Gen.MeteringReports/TestClasses/MeterAttributedWithXmlDescriptions.cs index 59e54b22359..48e32686a87 100644 --- a/test/Generators/Microsoft.Gen.MeteringReports/TestClasses/MeterAttributedWithXmlDescriptions.cs +++ b/test/Generators/Microsoft.Gen.MeteringReports/TestClasses/MeterAttributedWithXmlDescriptions.cs @@ -8,7 +8,6 @@ namespace TestClasses { [SuppressMessage("Usage", "CA1801:Review unused parameters", Justification = "For testing emitter for classes with description for metrics.")] - [SuppressMessage("Readability", "R9A046:Source generated metrics (fast metrics) should be located in 'Metric' class", Justification = "Metering generator tests")] internal static partial class MeterAttributedWithXmlDescriptions { /// diff --git a/test/Generators/Microsoft.Gen.MeteringReports/TestClasses/MeterDimensionsAttributedWithXmlDescriptions.cs b/test/Generators/Microsoft.Gen.MeteringReports/TestClasses/MeterDimensionsAttributedWithXmlDescriptions.cs index f9029ee3b62..3ac16a79fa3 100644 --- a/test/Generators/Microsoft.Gen.MeteringReports/TestClasses/MeterDimensionsAttributedWithXmlDescriptions.cs +++ b/test/Generators/Microsoft.Gen.MeteringReports/TestClasses/MeterDimensionsAttributedWithXmlDescriptions.cs @@ -9,7 +9,6 @@ namespace TestClasses { [SuppressMessage("Usage", "CA1801:Review unused parameters", Justification = "For testing emitter for classes with description for metrics.")] - [SuppressMessage("Readability", "R9A046:Source generated metrics (fast metrics) should be located in 'Metric' class", Justification = "Metering generator tests")] internal static partial class MeterDimensionsAttributedWithXmlDescriptions { diff --git a/test/Libraries/Microsoft.AspNetCore.HeaderParsing.Tests/HeaderParsingFeatureTests.cs b/test/Libraries/Microsoft.AspNetCore.HeaderParsing.Tests/HeaderParsingFeatureTests.cs index 8ec77acd22a..38b6d399c8e 100644 --- a/test/Libraries/Microsoft.AspNetCore.HeaderParsing.Tests/HeaderParsingFeatureTests.cs +++ b/test/Libraries/Microsoft.AspNetCore.HeaderParsing.Tests/HeaderParsingFeatureTests.cs @@ -127,7 +127,7 @@ public void TryParse_returns_default_on_header_not_found() public void TryParse_returns_false_on_error() { using var meter = new Meter(); - using var metricCollector = new MetricCollector(meter, @"R9.HeaderParsing.ParsingErrors"); + using var metricCollector = new MetricCollector(meter, @"HeaderParsing.ParsingErrors"); Context.Request.Headers["Date"] = "Not a date."; var feature = new HeaderParsingFeature(Registry, _logger, meter) { Context = Context }; @@ -180,7 +180,7 @@ public void Dispose_resets_state_and_returns_to_pool() public void CachingWorks() { using var meter = new Meter(); - using var metricCollector = new MetricCollector(meter, @"R9.HeaderParsing.CacheAccess"); + using var metricCollector = new MetricCollector(meter, @"HeaderParsing.CacheAccess"); Context.Request.Headers[HeaderNames.CacheControl] = "max-age=604800"; diff --git a/test/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization.Tests/ResourceHealthCheckTest.cs b/test/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization.Tests/ResourceHealthCheckTest.cs index 019ecefa0cd..984c997f0aa 100644 --- a/test/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization.Tests/ResourceHealthCheckTest.cs +++ b/test/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization.Tests/ResourceHealthCheckTest.cs @@ -22,7 +22,7 @@ public class ResourceHealthCheckTest 0.1, 0UL, 1000UL, - null!, + new ResourceUsageThresholds(), "", }, new object[] diff --git a/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Core/ResourceUtilizationTrackerServiceTest.cs b/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Core/ResourceUtilizationTrackerServiceTest.cs index 6683376ad18..462cf9676e5 100644 --- a/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Core/ResourceUtilizationTrackerServiceTest.cs +++ b/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Core/ResourceUtilizationTrackerServiceTest.cs @@ -59,7 +59,7 @@ public void BasicConstructor() Assert.NotNull(provider); Assert.NotNull(logger); Assert.NotNull(publishers); - Assert.Equal(2, publishers?.Length); + Assert.Equal(2, publishers.Length); } [Fact] @@ -152,7 +152,7 @@ var publishers Assert.NotNull(logger); Assert.NotNull(publishers); Assert.IsType(publishers); - Assert.Equal(2, publishers?.Length); + Assert.Equal(2, publishers.Length); } /// @@ -180,7 +180,7 @@ public void BasicConstructor_Complex_WithEmptyPublisher() Assert.NotNull(publishers); Assert.IsType(publishers); - Assert.Equal(1, publishers?.Length); + Assert.Single(publishers); } [Fact] diff --git a/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Linux/LinuxUtilizationProviderTest.cs b/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Linux/LinuxUtilizationProviderTest.cs deleted file mode 100644 index 3b27d4a5e76..00000000000 --- a/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Linux/LinuxUtilizationProviderTest.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using Microsoft.Extensions.Diagnostics.ResourceMonitoring.Internal; -using Microsoft.TestUtilities; -using Xunit; - -namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Test; - -[OSSkipCondition(OperatingSystems.Windows | OperatingSystems.MacOSX, SkipReason = "Linux specific package")] -public sealed class LinuxUtilizationProviderTest -{ - [ConditionalFact] - public void Null_Checks() - { - Assert.Throws(() => new LinuxUtilizationProvider(Microsoft.Extensions.Options.Options.Create(null!), null!, null!, null!, null!)); - Assert.Throws(() => new LinuxUtilizationProvider(null!, null!, null!, null!)); - } -} diff --git a/test/Libraries/Microsoft.Extensions.Hosting.Testing.Tests/FakeHostTest.cs b/test/Libraries/Microsoft.Extensions.Hosting.Testing.Tests/FakeHostTest.cs index 0722dbf37b9..c9ff3ca98e9 100644 --- a/test/Libraries/Microsoft.Extensions.Hosting.Testing.Tests/FakeHostTest.cs +++ b/test/Libraries/Microsoft.Extensions.Hosting.Testing.Tests/FakeHostTest.cs @@ -85,9 +85,7 @@ public void StartAsync_TokenProvided_LinksTheToken() #pragma warning disable CA2000 var sut = new FakeHost(hostMock.Object, new FakeHostOptions { StartUpTimeout = TimeSpan.FromMilliseconds(-1) }); #pragma warning restore CA2000 -#pragma warning disable R9A056 // Fire-and-forget async call inside a 'using' block _ = sut.StartAsync(cancellationTokenSource.Token); -#pragma warning restore R9A056 // Fire-and-forget async call inside a 'using' block Assert.False(receivedToken.IsCancellationRequested); cancellationTokenSource.Cancel(); @@ -147,9 +145,7 @@ public void StopAsync_TokenProvided_LinksTheToken() #pragma warning disable CA2000 var sut = new FakeHost(hostMock.Object, new FakeHostOptions { StartUpTimeout = TimeSpan.FromMilliseconds(-1) }); #pragma warning restore CA2000 -#pragma warning disable R9A056 // Fire-and-forget async call inside a 'using' block _ = sut.StopAsync(cancellationTokenSource.Token); -#pragma warning restore R9A056 // Fire-and-forget async call inside a 'using' block Assert.False(receivedToken.IsCancellationRequested); cancellationTokenSource.Cancel(); diff --git a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/FaultInjection/HttpFaultInjectionOptionsBuilderTest.cs b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/FaultInjection/HttpFaultInjectionOptionsBuilderTest.cs index 1c7e84bc172..a13a486daa3 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/FaultInjection/HttpFaultInjectionOptionsBuilderTest.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/FaultInjection/HttpFaultInjectionOptionsBuilderTest.cs @@ -45,7 +45,7 @@ public void Configure_WithConfigurationSection_ShouldConfigureChaosPolicyConfigP using var provider = services.BuildServiceProvider(); var result = provider.GetRequiredService>().Value; Assert.IsAssignableFrom(result); - Assert.NotNull(result.ChaosPolicyOptionsGroups?["OptionsGroupTest"]); + Assert.NotNull(result.ChaosPolicyOptionsGroups["OptionsGroupTest"]); } [Fact] diff --git a/test/Libraries/Microsoft.Extensions.Http.Telemetry.Tests/Metering/HttpMeteringHandlerTests.cs b/test/Libraries/Microsoft.Extensions.Http.Telemetry.Tests/Metering/HttpMeteringHandlerTests.cs index 857e9dd949a..3942d0a05df 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Telemetry.Tests/Metering/HttpMeteringHandlerTests.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Telemetry.Tests/Metering/HttpMeteringHandlerTests.cs @@ -787,7 +787,7 @@ public static void AddDefaultHttpClientMetering_RequestMetadataSetSuccessfully() DependencyName = "success_service", RequestRoute = "/foo" }; - requestMetadataContext?.SetRequestMetadata(requestMetadata); + requestMetadataContext.SetRequestMetadata(requestMetadata); Assert.NotNull(requestMetadataContext); } diff --git a/test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/FaultInjectionExtensionsTest.cs b/test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/FaultInjectionExtensionsTest.cs index a52a2c08c3e..1ace606ce7d 100644 --- a/test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/FaultInjectionExtensionsTest.cs +++ b/test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/FaultInjectionExtensionsTest.cs @@ -112,7 +112,7 @@ public void AddFaultInjection_WithAction_ShouldInvokeActionAndRegisterRequiredSe var chaosPolicyConfigProviderOptions = serviceProvider.GetRequiredService>().Value; Assert.IsAssignableFrom(chaosPolicyConfigProviderOptions); - Assert.NotNull(chaosPolicyConfigProviderOptions.ChaosPolicyOptionsGroups?["OptionsGroupTest"]); + Assert.NotNull(chaosPolicyConfigProviderOptions.ChaosPolicyOptionsGroups["OptionsGroupTest"]); var faultInjectionExceptionOptions1 = serviceProvider.GetRequiredService>().Get(testExceptionKey1); Assert.IsAssignableFrom(faultInjectionExceptionOptions1); diff --git a/test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/FaultInjectionOptionsBuilderTest.cs b/test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/FaultInjectionOptionsBuilderTest.cs index e1f0f8087f1..a3524c8c899 100644 --- a/test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/FaultInjectionOptionsBuilderTest.cs +++ b/test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/FaultInjectionOptionsBuilderTest.cs @@ -41,7 +41,7 @@ public void Configure_WithConfigurationSection_ShouldConfigureChaosPolicyConfigP using var provider = services.BuildServiceProvider(); var result = provider.GetRequiredService>().Value; Assert.IsAssignableFrom(result); - Assert.NotNull(result.ChaosPolicyOptionsGroups?["OptionsGroupTest"]); + Assert.NotNull(result.ChaosPolicyOptionsGroups["OptionsGroupTest"]); } [Fact] diff --git a/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Logging/SerialExtendedLoggerTests.cs b/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Logging/SerialExtendedLoggerTests.cs index 9eb70f5a29d..c4a84b68ce3 100644 --- a/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Logging/SerialExtendedLoggerTests.cs +++ b/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Logging/SerialExtendedLoggerTests.cs @@ -27,7 +27,7 @@ public static void BadContributors() using var el = new LoggerEventListener(); el.EventWritten += (_, e) => { - var payload = e?.Payload?[0]; + var payload = e.Payload?[0]; if (payload != null) { var s = payload.ToString(); diff --git a/test/TestUtilities/XUnit/ConditionalTheoryDiscoverer.cs b/test/TestUtilities/XUnit/ConditionalTheoryDiscoverer.cs index 3142df749a5..846038f8786 100644 --- a/test/TestUtilities/XUnit/ConditionalTheoryDiscoverer.cs +++ b/test/TestUtilities/XUnit/ConditionalTheoryDiscoverer.cs @@ -47,7 +47,7 @@ protected override IEnumerable CreateTestCasesForTheory(ITestFra : base.CreateTestCasesForTheory(discoveryOptions, testMethod, theoryAttribute); } - protected override IEnumerable CreateTestCasesForDataRow(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo theoryAttribute, object[] dataRow) + protected override IEnumerable CreateTestCasesForDataRow(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo theoryAttribute, object[]? dataRow) { var skipReason = testMethod.EvaluateSkipConditions(); if (skipReason == null && dataRow?.Length > 0)