From 4a262733790cef90683e6aadc586205f217598e1 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Mon, 24 Feb 2025 03:41:39 +1000 Subject: [PATCH] Disable a bunch of slow Analyzer rules thanks Morilli for the data --- .editorconfig | 22 +++++++++++++++++----- .global.editorconfig.ini | 24 ++++++++++++++++-------- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/.editorconfig b/.editorconfig index 893035f7e9..d4dac69bf6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -16,6 +16,8 @@ csharp_indent_labels = one_less_than_current # Style rules # Can't be in .globalconfig because dotnet format doesn't respect that https://github.com/dotnet/format/issues/1643 +# Remove `this` or `Me` qualification +dotnet_diagnostic.IDE0003.severity = silent # Remove unnecessary cast dotnet_diagnostic.IDE0004.severity = warning # Remove unnecessary import @@ -23,21 +25,29 @@ dotnet_diagnostic.IDE0005.severity = warning # Use var instead of explicit type dotnet_diagnostic.IDE0007.severity = suggestion # Use explicit type instead of var -dotnet_diagnostic.IDE0008.severity = suggestion +dotnet_diagnostic.IDE0008.severity = silent +# Add `this` or `Me` qualification +dotnet_diagnostic.IDE0009.severity = silent # Inline variable declaration dotnet_diagnostic.IDE0018.severity = warning # Use pattern matching to avoid as followed by a null check dotnet_diagnostic.IDE0019.severity = warning # Use pattern matching to avoid is check followed by a cast (with variable) dotnet_diagnostic.IDE0020.severity = warning +# Use expression body for constructors +dotnet_diagnostic.IDE0021.severity = silent # UseExpressionBodyDiagnosticAnalyzer very slow # Use expression body for methods -dotnet_diagnostic.IDE0022.severity = suggestion +dotnet_diagnostic.IDE0022.severity = silent # UseExpressionBodyDiagnosticAnalyzer very slow +# Use expression body for conversion operators +dotnet_diagnostic.IDE0023.severity = silent # UseExpressionBodyDiagnosticAnalyzer very slow +# Use expression body for operators +dotnet_diagnostic.IDE0024.severity = silent # UseExpressionBodyDiagnosticAnalyzer very slow # Use expression body for properties -dotnet_diagnostic.IDE0025.severity = suggestion +dotnet_diagnostic.IDE0025.severity = silent # UseExpressionBodyDiagnosticAnalyzer very slow # Use expression body for indexers -dotnet_diagnostic.IDE0026.severity = suggestion +dotnet_diagnostic.IDE0026.severity = silent # UseExpressionBodyDiagnosticAnalyzer very slow # Use expression body for accessors -dotnet_diagnostic.IDE0027.severity = suggestion +dotnet_diagnostic.IDE0027.severity = silent # UseExpressionBodyDiagnosticAnalyzer very slow # Null check can be simplified dotnet_diagnostic.IDE0029.severity = warning # Null check can be simplified @@ -65,6 +75,8 @@ dotnet_diagnostic.IDE0054.severity = warning dotnet_diagnostic.IDE0056.severity = suggestion # Use range operator dotnet_diagnostic.IDE0057.severity = suggestion +# Use expression body for local functions +dotnet_diagnostic.IDE0061.severity = silent # UseExpressionBodyDiagnosticAnalyzer very slow # Use simple using statement dotnet_diagnostic.IDE0063.severity = suggestion # Make struct fields writable diff --git a/.global.editorconfig.ini b/.global.editorconfig.ini index 3a8906f759..0762cf21e5 100644 --- a/.global.editorconfig.ini +++ b/.global.editorconfig.ini @@ -67,6 +67,10 @@ dotnet_diagnostic.CA1305.severity = error dotnet_code_quality.CA1305.excluded_symbol_names = T:System.Byte|T:System.SByte|T:System.Int16|T:System.UInt16|T:System.Int32|T:System.UInt32|T:System.Int64|T:System.UInt64|T:System.String|T:System.Text.StringBuilder|T:System.Convert # Specify marshalling for P/Invoke string arguments dotnet_diagnostic.CA2101.severity = suggestion +# Specify StringComparison for clarity +dotnet_diagnostic.CA1307.severity = silent # SpecifyStringComparisonAnalyzer very slow +# Specify StringComparison for correctness +dotnet_diagnostic.CA1310.severity = silent # SpecifyStringComparisonAnalyzer very slow ## Performance rules @@ -100,6 +104,8 @@ dotnet_diagnostic.CA1816.severity = none dotnet_diagnostic.CA2201.severity = suggestion # Implement serialization constructors dotnet_diagnostic.CA2229.severity = silent +# Opt in to preview features before using them +dotnet_diagnostic.CA2252.severity = silent # CSharpDetectPreviewFeatureAnalyzer very slow ## .NET DocumentationAnalyzers style rules @@ -202,7 +208,7 @@ dotnet_diagnostic.MA0030.severity = error # Optimize Enumerable.Count() usage dotnet_diagnostic.MA0031.severity = error # Use an overload with a CancellationToken argument -dotnet_diagnostic.MA0032.severity = silent +dotnet_diagnostic.MA0032.severity = silent # UseAnOverloadThatHasCancellationTokenAnalyzer very slow # Do not tag instance fields with ThreadStaticAttribute dotnet_diagnostic.MA0033.severity = error # Do not use dangerous threading methods @@ -216,17 +222,17 @@ dotnet_diagnostic.MA0038.severity = silent # Do not write your own certificate validation method dotnet_diagnostic.MA0039.severity = error # Flow the cancellation token -dotnet_diagnostic.MA0040.severity = error +dotnet_diagnostic.MA0040.severity = silent # UseAnOverloadThatHasCancellationTokenAnalyzer very slow # Make property static dotnet_diagnostic.MA0041.severity = silent # Do not use blocking calls in an async method -dotnet_diagnostic.MA0042.severity = error +dotnet_diagnostic.MA0042.severity = silent # DoNotUseBlockingCallInAsyncContextAnalyzer very slow # Use nameof operator in ArgumentException dotnet_diagnostic.MA0043.severity = error # Remove useless ToString call dotnet_diagnostic.MA0044.severity = warning # Do not use blocking call in a sync method (need to make containing method async) -dotnet_diagnostic.MA0045.severity = silent +dotnet_diagnostic.MA0045.severity = silent # DoNotUseBlockingCallInAsyncContextAnalyzer very slow # Use EventHandler to declare events dotnet_diagnostic.MA0046.severity = silent # Declare types in namespaces @@ -294,9 +300,9 @@ dotnet_diagnostic.MA0077.severity = error # Use 'Cast' instead of 'Select' to cast dotnet_diagnostic.MA0078.severity = error # Flow the cancellation token using .WithCancellation() -dotnet_diagnostic.MA0079.severity = error +dotnet_diagnostic.MA0079.severity = silent # UseAnOverloadThatHasCancellationTokenAnalyzer very slow # Use a cancellation token using .WithCancellation() -dotnet_diagnostic.MA0080.severity = error +dotnet_diagnostic.MA0080.severity = silent # UseAnOverloadThatHasCancellationTokenAnalyzer very slow # Method overrides should not omit params keyword dotnet_diagnostic.MA0081.severity = error # NaN should not be used in comparisons @@ -454,7 +460,7 @@ dotnet_diagnostic.SA1004.severity = silent # Single line comments should begin with single space dotnet_diagnostic.SA1005.severity = silent # Preprocessor keywords should not be preceded by space -dotnet_diagnostic.SA1006.severity = error +dotnet_diagnostic.SA1006.severity = silent # SA1006PreprocessorKeywordsMustNotBePrecededBySpace very slow # Opening parenthesis should be spaced correctly dotnet_diagnostic.SA1008.severity = silent # Closing parenthesis should be spaced correctly @@ -471,6 +477,8 @@ dotnet_diagnostic.SA1013.severity = silent dotnet_diagnostic.SA1015.severity = silent # Member access symbols should be spaced correctly dotnet_diagnostic.SA1019.severity = error +# Increment decrement symbols should be spaced correctly +dotnet_diagnostic.SA1020.severity = silent # SA1020IncrementDecrementSymbolsMustBeSpacedCorrectly very slow # Negative signs should be spaced correctly dotnet_diagnostic.SA1021.severity = silent # Dereference and access of symbols should be spaced correctly @@ -509,7 +517,7 @@ dotnet_diagnostic.SA1118.severity = silent # Comments should contain text dotnet_diagnostic.SA1120.severity = warning # Use built-in type alias -dotnet_diagnostic.SA1121.severity = error +dotnet_diagnostic.SA1121.severity = silent # SA1121UseBuiltInTypeAlias very slow # Use string.Empty for empty strings dotnet_diagnostic.SA1122.severity = silent # Generic type constraints should be on their own line