From 1af3260e9a7f89a59a23f45656fda7e0f85dc7db Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Wed, 4 Nov 2020 07:04:06 -0800 Subject: [PATCH 1/4] Convert .ruleset to .globalconfig --- eng/config/rulesets/Empty.ruleset | 4 + eng/config/rulesets/NonShipping.globalconfig | 26 +++++ eng/config/rulesets/NonShipping.ruleset | 40 -------- eng/config/rulesets/Shipping.globalconfig | 102 +++++++++++++++++++ eng/config/rulesets/Shipping.ruleset | 95 ----------------- eng/targets/Imports.targets | 11 +- 6 files changed, 141 insertions(+), 137 deletions(-) create mode 100644 eng/config/rulesets/Empty.ruleset create mode 100644 eng/config/rulesets/NonShipping.globalconfig delete mode 100644 eng/config/rulesets/NonShipping.ruleset create mode 100644 eng/config/rulesets/Shipping.globalconfig delete mode 100644 eng/config/rulesets/Shipping.ruleset diff --git a/eng/config/rulesets/Empty.ruleset b/eng/config/rulesets/Empty.ruleset new file mode 100644 index 0000000000000..1e31518e0fa0b --- /dev/null +++ b/eng/config/rulesets/Empty.ruleset @@ -0,0 +1,4 @@ + + + + diff --git a/eng/config/rulesets/NonShipping.globalconfig b/eng/config/rulesets/NonShipping.globalconfig new file mode 100644 index 0000000000000..7586f28fc804a --- /dev/null +++ b/eng/config/rulesets/NonShipping.globalconfig @@ -0,0 +1,26 @@ +is_global = true + +# For tests, the ConfigureAwait(true) is good enough. Either they are already running on a thread pool +# thread where ConfigureAwait(false) does nothing, or we're running the workload from an STA thread +# where we want to marshal the continuations back to it. +dotnet_diagnostic.CA2007.severity = none + +# Mark constant field as 'const' instead of static readonly - not useful for tests +dotnet_diagnostic.CA1802.severity = none + +dotnet_diagnostic.RS1001.severity = none +# CodeFix providers should override GetFixAllProvider - suppress for non-shipping/test projects +dotnet_diagnostic.RS1016.severity = none +# DiagnosticId must be unique across analyzers - suppress for non-shipping/test projects +dotnet_diagnostic.RS1019.severity = none +# Configure generated code analysis - suppress for non-shipping/test projects +dotnet_diagnostic.RS1025.severity = none +# Enable concurrent execution - suppress for non-shipping/test projects +dotnet_diagnostic.RS1026.severity = none +# Do not use generic CodeAction.Create to create CodeAction - not useful for tests +dotnet_diagnostic.RS0005.severity = none +# Do not call 'GetTestAccessor()' from production code: does not apply to tests +dotnet_diagnostic.RS0043.severity = none + +# VSTHRD200: Use "Async" suffix for async methods +dotnet_diagnostic.VSTHRD200.severity = none diff --git a/eng/config/rulesets/NonShipping.ruleset b/eng/config/rulesets/NonShipping.ruleset deleted file mode 100644 index 29d0ee3f8b077..0000000000000 --- a/eng/config/rulesets/NonShipping.ruleset +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eng/config/rulesets/Shipping.globalconfig b/eng/config/rulesets/Shipping.globalconfig new file mode 100644 index 0000000000000..717a52cc5aff0 --- /dev/null +++ b/eng/config/rulesets/Shipping.globalconfig @@ -0,0 +1,102 @@ +is_global = true + +dotnet_diagnostic.CA1067.severity = warning +dotnet_diagnostic.CA1068.severity = warning +dotnet_diagnostic.CA1200.severity = warning +dotnet_diagnostic.CA1802.severity = warning +dotnet_diagnostic.CA1821.severity = warning +dotnet_diagnostic.CA2007.severity = warning + +dotnet_diagnostic.IDE0055.severity = warning + +dotnet_diagnostic.RS1001.severity = none +dotnet_diagnostic.RS1002.severity = none +dotnet_diagnostic.RS1003.severity = none +dotnet_diagnostic.RS1004.severity = none +dotnet_diagnostic.RS1005.severity = none +dotnet_diagnostic.RS1006.severity = none +dotnet_diagnostic.RS1008.severity = none +dotnet_diagnostic.RS1009.severity = none +dotnet_diagnostic.RS1010.severity = none +dotnet_diagnostic.RS1011.severity = none +dotnet_diagnostic.RS1012.severity = none +dotnet_diagnostic.RS1013.severity = none +dotnet_diagnostic.RS1014.severity = warning +# https://github.com/dotnet/roslyn/issues/26420: Enable rule RS1022 for Roslyn.sln +dotnet_diagnostic.RS1022.severity = none +# RS1024: Compare symbols correctly +dotnet_diagnostic.RS1024.severity = refactoring + +dotnet_diagnostic.AD0001.severity = error + +dotnet_diagnostic.RS0001.severity = warning +dotnet_diagnostic.RS0002.severity = warning +dotnet_diagnostic.RS0005.severity = warning +dotnet_diagnostic.RS0006.severity = error +dotnet_diagnostic.RS0012.severity = warning +dotnet_diagnostic.RS0014.severity = warning +dotnet_diagnostic.RS0015.severity = warning +dotnet_diagnostic.RS0016.severity = error +dotnet_diagnostic.RS0017.severity = error +dotnet_diagnostic.RS0018.severity = warning +dotnet_diagnostic.RS0022.severity = error +dotnet_diagnostic.RS0023.severity = error +dotnet_diagnostic.RS0024.severity = error +dotnet_diagnostic.RS0025.severity = error +dotnet_diagnostic.RS0026.severity = error +dotnet_diagnostic.RS0027.severity = error +# RS0040: Defaultable types should have defaultable fields +dotnet_diagnostic.RS0040.severity = none +# RS0046: Avoid the 'Opt' suffix in nullable-enabled code (too noisy right now) +dotnet_diagnostic.RS0046.severity = info +# RS0047: (Suppressor) The 'Type.FullName' property is never null when using the syntax 'typeof(T).FullName' +dotnet_diagnostic.RS0047.severity = none + +# allow skipped tests, with a code fix to unskip them +dotnet_diagnostic.xUnit1004.severity = refactoring +# xUnit2006: "do not use generic Assert.Equal to test string equality" is a valid assert, but very noisy right now +dotnet_diagnostic.xUnit2006.severity = none +# xUnit2009: "do not use Assert.True to check for substrings" is a valid assert, but very noisy right now +dotnet_diagnostic.xUnit2009.severity = none +# xUnit2012: "do not use Enumerable.Any() to check if a value exists in a collection" is a valid assert, but very noisy right now +dotnet_diagnostic.xUnit2012.severity = none +# xUnit2013: "do not use Assert.Equal() to check for collection size" is a valid assert, but very noisy right now +dotnet_diagnostic.xUnit2013.severity = none +# xUnit2017: "do not use Contains() to check if a value exists in a collection" is a valid assert, but very noisy right now +dotnet_diagnostic.xUnit2017.severity = none + +# https://github.com/Microsoft/VSSDK-Analyzers/blob/master/doc/index.md +# VSSDK001: Derive from AsyncPackage +dotnet_diagnostic.VSSDK001.severity = warning +# VSSDK003: Support async tool windows +dotnet_diagnostic.VSSDK003.severity = warning +# VSSDK006: Remove suppression. https://github.com/dotnet/roslyn/issues/38471 +dotnet_diagnostic.VSSDK006.severity = none + +# VSTHRD002: Avoid problematic synchronous waits +dotnet_diagnostic.VSTHRD002.severity = none +# VSTHRD003: Avoid awaiting foreign Tasks https://github.com/dotnet/roslyn/issues/34331 +dotnet_diagnostic.VSTHRD003.severity = none +# VSTHRD103: Call async methods when in an async method +dotnet_diagnostic.VSTHRD103.severity = none +# VSTHRD010: Invoke single-threaded types on Main thread https://github.com/dotnet/roslyn/issues/29275 +dotnet_diagnostic.VSTHRD010.severity = none +# VSTHRD110: Observe result of async calls +dotnet_diagnostic.VSTHRD110.severity = none + +dotnet_diagnostic.HAA0101.severity = none +dotnet_diagnostic.HAA0102.severity = none +dotnet_diagnostic.HAA0201.severity = none +dotnet_diagnostic.HAA0202.severity = none +dotnet_diagnostic.HAA0301.severity = none +dotnet_diagnostic.HAA0302.severity = none +dotnet_diagnostic.HAA0303.severity = none +dotnet_diagnostic.HAA0401.severity = none +dotnet_diagnostic.HAA0501.severity = none +dotnet_diagnostic.HAA0502.severity = none +dotnet_diagnostic.HAA0503.severity = none +dotnet_diagnostic.HAA0506.severity = none +dotnet_diagnostic.HAA0601.severity = none +dotnet_diagnostic.HAA0602.severity = none +dotnet_diagnostic.HAA0603.severity = none +dotnet_diagnostic.HeapAnalyzerReadonlyMethodGroupAllocationRule.severity = none diff --git a/eng/config/rulesets/Shipping.ruleset b/eng/config/rulesets/Shipping.ruleset deleted file mode 100644 index cda6d034d71a8..0000000000000 --- a/eng/config/rulesets/Shipping.ruleset +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eng/targets/Imports.targets b/eng/targets/Imports.targets index 4cbf2d6f342c2..2fca75c11d644 100644 --- a/eng/targets/Imports.targets +++ b/eng/targets/Imports.targets @@ -102,10 +102,17 @@ - $(RepositoryEngineeringDir)config\rulesets\Shipping.ruleset - $(RepositoryEngineeringDir)config\rulesets\NonShipping.ruleset + $(RepositoryEngineeringDir)config\rulesets\Empty.ruleset + + + + + + + + - - - + + + + + From 6fa00b256adb90ca12779608b75952b42dd7e09d Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Wed, 4 Nov 2020 16:17:17 -0800 Subject: [PATCH 3/4] Remove Empty.ruleset --- eng/config/rulesets/Empty.ruleset | 4 ---- eng/targets/Imports.targets | 5 ----- 2 files changed, 9 deletions(-) delete mode 100644 eng/config/rulesets/Empty.ruleset diff --git a/eng/config/rulesets/Empty.ruleset b/eng/config/rulesets/Empty.ruleset deleted file mode 100644 index 1e31518e0fa0b..0000000000000 --- a/eng/config/rulesets/Empty.ruleset +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/eng/targets/Imports.targets b/eng/targets/Imports.targets index a4f7f32632449..34968ba4204e4 100644 --- a/eng/targets/Imports.targets +++ b/eng/targets/Imports.targets @@ -100,11 +100,6 @@ true - - - $(RepositoryEngineeringDir)config\rulesets\Empty.ruleset - - From 9ad67f27beb99e162382b2e71c978a8b75d7e0cc Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Wed, 4 Nov 2020 16:29:48 -0800 Subject: [PATCH 4/4] Rename eng/config/rulesets to eng/config/globalconfigs --- eng/config/{rulesets => globalconfigs}/Common.globalconfig | 0 .../{rulesets => globalconfigs}/NonShipping.globalconfig | 0 .../{rulesets => globalconfigs}/Shipping.globalconfig | 0 eng/targets/Imports.targets | 6 +++--- 4 files changed, 3 insertions(+), 3 deletions(-) rename eng/config/{rulesets => globalconfigs}/Common.globalconfig (100%) rename eng/config/{rulesets => globalconfigs}/NonShipping.globalconfig (100%) rename eng/config/{rulesets => globalconfigs}/Shipping.globalconfig (100%) diff --git a/eng/config/rulesets/Common.globalconfig b/eng/config/globalconfigs/Common.globalconfig similarity index 100% rename from eng/config/rulesets/Common.globalconfig rename to eng/config/globalconfigs/Common.globalconfig diff --git a/eng/config/rulesets/NonShipping.globalconfig b/eng/config/globalconfigs/NonShipping.globalconfig similarity index 100% rename from eng/config/rulesets/NonShipping.globalconfig rename to eng/config/globalconfigs/NonShipping.globalconfig diff --git a/eng/config/rulesets/Shipping.globalconfig b/eng/config/globalconfigs/Shipping.globalconfig similarity index 100% rename from eng/config/rulesets/Shipping.globalconfig rename to eng/config/globalconfigs/Shipping.globalconfig diff --git a/eng/targets/Imports.targets b/eng/targets/Imports.targets index 34968ba4204e4..71fe5f248439d 100644 --- a/eng/targets/Imports.targets +++ b/eng/targets/Imports.targets @@ -103,11 +103,11 @@ - + - + - +