Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert .ruleset to .globalconfig #49181

Merged
merged 4 commits into from
Nov 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions eng/config/globalconfigs/Common.globalconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
is_global = true

dotnet_diagnostic.CA1067.severity = warning
dotnet_diagnostic.CA1068.severity = warning
dotnet_diagnostic.CA1200.severity = warning
dotnet_diagnostic.CA1821.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.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 = suggestion
# 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
25 changes: 25 additions & 0 deletions eng/config/globalconfigs/NonShipping.globalconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
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

# 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
6 changes: 6 additions & 0 deletions eng/config/globalconfigs/Shipping.globalconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
is_global = true

dotnet_diagnostic.CA1802.severity = warning
dotnet_diagnostic.CA2007.severity = warning

dotnet_diagnostic.RS0005.severity = warning
40 changes: 0 additions & 40 deletions eng/config/rulesets/NonShipping.ruleset

This file was deleted.

95 changes: 0 additions & 95 deletions eng/config/rulesets/Shipping.ruleset

This file was deleted.

14 changes: 9 additions & 5 deletions eng/targets/Imports.targets
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,15 @@
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
</PropertyGroup>

<!-- Rulesets -->
<PropertyGroup Condition="'$(CodeAnalysisRuleSet)' == ''">
<CodeAnalysisRuleSet Condition="'$(IsShipping)' == 'true'">$(RepositoryEngineeringDir)config\rulesets\Shipping.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet Condition="'$(IsShipping)' != 'true'">$(RepositoryEngineeringDir)config\rulesets\NonShipping.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<!-- Global Analyzer Config -->
<ItemGroup>
<!-- Always include Common.globalconfig -->
<EditorConfigFiles Include="$(RepositoryEngineeringDir)config\globalconfigs\Common.globalconfig" />
<!-- Include Shipping.globalconfig for shipping projects -->
<EditorConfigFiles Condition="'$(IsShipping)' == 'true'" Include="$(RepositoryEngineeringDir)config\globalconfigs\Shipping.globalconfig" />
<!-- Include NonShipping.globalconfig for non-shipping projects -->
<EditorConfigFiles Condition="'$(IsShipping)' != 'true'" Include="$(RepositoryEngineeringDir)config\globalconfigs\NonShipping.globalconfig" />
</ItemGroup>

<!--
Some dependencies bring in references to UIAutomationClient and UIAutomationTypes. These conflict with the faster
Expand Down