From 7b7803488cc83d7cb93d7806ef8f59e666aba95a Mon Sep 17 00:00:00 2001 From: martincostello Date: Tue, 16 Jul 2024 09:36:39 +0100 Subject: [PATCH 1/3] Enable CA1861 and IDE0300 warnings Enable warnings for CA1861 and IDE0300 in EditorConfig. --- .editorconfig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.editorconfig b/.editorconfig index 3e2a062119ef..d78d046dcc51 100644 --- a/.editorconfig +++ b/.editorconfig @@ -230,6 +230,9 @@ dotnet_diagnostic.CA1857.severity = warning # CA1858: Use 'StartsWith' instead of 'IndexOf' dotnet_diagnostic.CA1858.severity = warning +# CA1861: Avoid constant arrays as arguments +dotnet_diagnostic.CA1861.severity = warning + # CA2007: Consider calling ConfigureAwait on the awaited task dotnet_diagnostic.CA2007.severity = warning @@ -335,6 +338,9 @@ dotnet_diagnostic.IDE0161.severity = warning # IDE0200: Lambda expression can be removed dotnet_diagnostic.IDE0200.severity = warning +# IDE0300: Use collection expression for array +dotnet_diagnostic.IDE0300.severity = warning + # IDE2000: Disallow multiple blank lines dotnet_style_allow_multiple_blank_lines_experimental = false dotnet_diagnostic.IDE2000.severity = warning From 8931961e41e5f6d1755bd69265523c1861760d95 Mon Sep 17 00:00:00 2001 From: Martin Costello Date: Tue, 16 Jul 2024 09:46:30 +0100 Subject: [PATCH 2/3] Exclude tools Exclude new rules from tools. --- .editorconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.editorconfig b/.editorconfig index d78d046dcc51..b6e14840075e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -410,6 +410,8 @@ dotnet_diagnostic.CA1856.severity = suggestion dotnet_diagnostic.CA1857.severity = suggestion # CA1858: Use 'StartsWith' instead of 'IndexOf' dotnet_diagnostic.CA1858.severity = suggestion +# CA1861: Avoid constant arrays as arguments +dotnet_diagnostic.CA1861.severity = suggestion # CA2007: Consider calling ConfigureAwait on the awaited task dotnet_diagnostic.CA2007.severity = suggestion # CA2008: Do not create tasks without passing a TaskScheduler @@ -446,6 +448,8 @@ dotnet_diagnostic.IDE0060.severity = suggestion dotnet_diagnostic.IDE0062.severity = suggestion # IDE0200: Lambda expression can be removed dotnet_diagnostic.IDE0200.severity = suggestion +# IDE0300: Use collection expression for array +dotnet_diagnostic.IDE0300.severity = suggestion # CA2016: Forward the 'CancellationToken' parameter to methods that take one dotnet_diagnostic.CA2016.severity = suggestion From 9c22775d44b2c2bdb81b1a6ce212131ef6e3d232 Mon Sep 17 00:00:00 2001 From: Martin Costello Date: Tue, 16 Jul 2024 09:56:21 +0100 Subject: [PATCH 3/3] Disable IDE0300 for Shared Disable for the shared code. --- .editorconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.editorconfig b/.editorconfig index b6e14840075e..55589d0a8ed6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -473,3 +473,5 @@ dotnet_diagnostic.IDE0161.severity = silent [{**/Shared/**.cs,**/microsoft.extensions.hostfactoryresolver.sources/**.{cs,vb}}] # IDE0005: Remove unused usings. Ignore for shared src files since imports for those depend on the projects in which they are included. dotnet_diagnostic.IDE0005.severity = silent +# IDE0300: Use collection expression for array +dotnet_diagnostic.IDE0300.severity = silent