Skip to content

Commit db4f25a

Browse files
committed
Remove rulesets
1 parent 460a0e5 commit db4f25a

File tree

13 files changed

+161
-208
lines changed

13 files changed

+161
-208
lines changed

.editorconfig

Lines changed: 0 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,6 @@ root = true
88
indent_style = space
99
# (Please don't specify an indent_size here; that has too many unintended consequences.)
1010

11-
# RS1024: Compare symbols correctly
12-
# https://github.com/dotnet/roslyn-analyzers/issues/3389
13-
dotnet_diagnostic.RS1024.severity = none
14-
15-
# IDE0078: Use pattern matching
16-
# https://github.com/dotnet/roslyn/issues/51691
17-
# https://github.com/dotnet/roslyn/issues/51693
18-
dotnet_diagnostic.IDE0078.severity = silent
19-
2011
# Code files
2112
[*.{cs,csx,vb,vbx}]
2213
indent_size = 4
@@ -181,67 +172,9 @@ visual_basic_style_unused_value_assignment_preference = unused_local_variable:wa
181172
### Configuration for IDE code style by diagnostic IDs ###
182173
[*.{cs,vb}]
183174

184-
# Default severity for all IDE code style rules with category 'Style'
185-
dotnet_analyzer_diagnostic.category-Style.severity = warning
186-
187-
# Default severity for all IDE code quality rules with category 'CodeQuality'
188-
dotnet_analyzer_diagnostic.category-CodeQuality.severity = warning
189-
190-
# IDE0066: Convert switch statement to expression
191-
dotnet_diagnostic.IDE0066.severity = suggestion
192-
193175
# IDE0073: File header
194176
file_header_template = Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information.
195177

196-
# IDE0001: Name can be simplified
197-
dotnet_diagnostic.IDE0001.severity = silent
198-
199-
# IDE0002: Name can be simplified
200-
dotnet_diagnostic.IDE0002.severity = silent
201-
202-
# IDE0003: Name can be simplified
203-
dotnet_diagnostic.IDE0003.severity = silent
204-
205-
# IDE0007: Use 'var' instead of explicit type
206-
dotnet_diagnostic.IDE0007.severity = silent
207-
208-
# IDE0010: Add missing cases in switch statement
209-
dotnet_diagnostic.IDE0010.severity = silent
210-
211-
# IDE0017: Object initialization can be simplified
212-
dotnet_diagnostic.IDE0017.severity = silent
213-
214-
# IDE0045: 'if' statement can be simplified
215-
dotnet_diagnostic.IDE0045.severity = silent
216-
217-
# IDE0046: 'if' statement can be simplified
218-
dotnet_diagnostic.IDE0046.severity = silent
219-
220-
# IDE0048: Parentheses should be added for clarity
221-
dotnet_diagnostic.IDE0048.severity = silent
222-
223-
# IDE0058: Expression value is never used
224-
dotnet_diagnostic.IDE0058.severity = silent
225-
226-
# IDE0065: Using directives must be placed outside of a namespace declaration
227-
# Can remove the below entry and turn it into a warning once https://github.com/dotnet/roslyn/issues/43271 is resolved.
228-
dotnet_diagnostic.IDE0065.severity = silent
229-
230-
# IDE0072: Populate switch
231-
dotnet_diagnostic.IDE0072.severity = silent
232-
233-
# IDE0083: Use pattern matching
234-
dotnet_diagnostic.IDE0083.severity = silent
235-
236-
# IDE0120: Simplify linq expression
237-
dotnet_diagnostic.IDE0120.severity = silent
238-
239-
# IDE0130: Namespace does not match folder structure
240-
dotnet_diagnostic.IDE0130.severity = silent
241-
242-
# IDE0150: Null check can be clarified
243-
dotnet_diagnostic.IDE0150.severity = silent
244-
245178
# IDE2000: Allow multiple blank lines
246179
dotnet_style_allow_multiple_blank_lines_experimental = false
247180

@@ -275,23 +208,6 @@ dotnet_code_quality.CA1720.api_surface = public
275208
# CA1715: Identifiers should have correct prefix
276209
dotnet_code_quality.CA1715.exclude_single_letter_type_parameters = true
277210

278-
# CA1002: Do not expose generic lists
279-
dotnet_diagnostic.CA1002.severity = suggestion
280-
281-
# CA1024: Use properties where appropriate
282-
dotnet_diagnostic.CA1024.severity = suggestion
283-
284-
# CA1033: Interface methods should be callable by child types
285-
dotnet_diagnostic.CA1033.severity = suggestion
286-
287-
# CA1307: Specify StringComparison for clarity
288-
dotnet_diagnostic.CA1307.severity = suggestion
289-
290-
# CA1711: Identifiers should not have incorrect suffix
291-
dotnet_diagnostic.CA1711.severity = suggestion
292-
293-
# CA1309: Use ordinal string comparison
294-
dotnet_diagnostic.CA1309.severity = suggestion
295211

296212
# CA1305: Pass IFormatProvider - https://github.com/dotnet/roslyn-analyzers/issues/6379
297213
dotnet_diagnostic.CA1305.severity = suggestion
@@ -304,12 +220,3 @@ dotnet_diagnostic.CA1851.severity = suggestion
304220

305221
# Analyzers bail-out if the PublicAPI.*.txt file is not found
306222
dotnet_public_api_analyzer.require_api_files = true
307-
308-
### Configuration for vs-threading analyzers executed on this repo ###
309-
[*.{cs,vb}]
310-
311-
# VSTHRD002: Avoid problematic synchronous waits
312-
dotnet_diagnostic.VSTHRD002.severity = none
313-
314-
# VSTHRD011: Use AsyncLazy<T>
315-
dotnet_diagnostic.VSTHRD011.severity = none

Directory.Build.targets

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@
5050
<ExcludeByFile></ExcludeByFile>
5151
</PropertyGroup>
5252

53+
<!-- Global Analyzer Config -->
54+
<ItemGroup>
55+
<!-- Always include Common.globalconfig -->
56+
<EditorConfigFiles Include="$(RepositoryEngineeringDir)globalconfigs\Common.globalconfig" />
57+
<!-- Include Shipping.globalconfig for shipping projects -->
58+
<EditorConfigFiles Condition="'$(IsShipping)' == 'true'" Include="$(RepositoryEngineeringDir)globalconfigs\Shipping.globalconfig" />
59+
<!-- Include NonShipping.globalconfig for non-shipping projects -->
60+
<EditorConfigFiles Condition="'$(IsShipping)' != 'true'" Include="$(RepositoryEngineeringDir)globalconfigs\NonShipping.globalconfig" />
61+
</ItemGroup>
62+
5363
<Target Name="OuterInstrumentModulesNoBuild" BeforeTargets="RunTests" Condition="'$(IsUnitTestProject)' == 'true' AND '$(TargetFramework)' == ''">
5464
<MSBuild
5565
Projects="$(MSBuildProjectFullPath)"
@@ -73,4 +83,4 @@
7383
BeforeTargets="Test"
7484
DependsOnTargets="GenerateCoverageResult"
7585
Condition="'$(IsUnitTestProject)' == 'true' AND '$(TargetFramework)' != '' AND '$(CollectCoverage)' == 'true'" />
76-
</Project>
86+
</Project>

eng/Analyzers_NonShippingRules.ruleset

Lines changed: 0 additions & 40 deletions
This file was deleted.

eng/Analyzers_ShippingRules.ruleset

Lines changed: 0 additions & 41 deletions
This file was deleted.

eng/globalconfigs/Common.globalconfig

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
is_global = true
2+
3+
# Default severity for all IDE code style rules with category 'Style'
4+
dotnet_analyzer_diagnostic.category-Style.severity = warning
5+
6+
# Default severity for all IDE code quality rules with category 'CodeQuality'
7+
dotnet_analyzer_diagnostic.category-CodeQuality.severity = warning
8+
9+
### Configuration for RSxxxx rules ###
10+
11+
# RS1024: Compare symbols correctly
12+
# https://github.com/dotnet/roslyn-analyzers/issues/3389
13+
dotnet_diagnostic.RS1024.severity = none
14+
15+
# Parts exported with MEFv2 must be marked with 'SharedAttribute', un-needed here
16+
dotnet_diagnostic.RS0023.severity = none
17+
18+
# Exported parts should be marked with 'ImportingConstructorAttribute', un-needed here
19+
dotnet_diagnostic.RS0034.severity = none
20+
21+
# Use 'null' instead of 'default' for nullable types
22+
dotnet_diagnostic.RS0038.severity = none
23+
24+
# TODO: Remove this exclusion and fix related issues, tracked by https://github.com/dotnet/roslyn-analyzers/issues/3915
25+
#dotnet_diagnostic.RS0041.severity = none
26+
27+
### Configuration for IDE code style by diagnostic IDs ###
28+
29+
# IDE0078: Use pattern matching
30+
# https://github.com/dotnet/roslyn/issues/51691
31+
# https://github.com/dotnet/roslyn/issues/51693
32+
dotnet_diagnostic.IDE0078.severity = silent
33+
34+
# IDE0066: Convert switch statement to expression
35+
dotnet_diagnostic.IDE0066.severity = suggestion
36+
37+
# IDE0001: Name can be simplified
38+
dotnet_diagnostic.IDE0001.severity = silent
39+
40+
# IDE0002: Name can be simplified
41+
dotnet_diagnostic.IDE0002.severity = silent
42+
43+
# IDE0003: Name can be simplified
44+
dotnet_diagnostic.IDE0003.severity = silent
45+
46+
# IDE0007: Use 'var' instead of explicit type
47+
dotnet_diagnostic.IDE0007.severity = silent
48+
49+
# IDE0010: Add missing cases in switch statement
50+
dotnet_diagnostic.IDE0010.severity = silent
51+
52+
# IDE0017: Object initialization can be simplified
53+
dotnet_diagnostic.IDE0017.severity = silent
54+
55+
# IDE0045: 'if' statement can be simplified
56+
dotnet_diagnostic.IDE0045.severity = silent
57+
58+
# IDE0046: 'if' statement can be simplified
59+
dotnet_diagnostic.IDE0046.severity = silent
60+
61+
# IDE0048: Parentheses should be added for clarity
62+
dotnet_diagnostic.IDE0048.severity = silent
63+
64+
# IDE0058: Expression value is never used
65+
dotnet_diagnostic.IDE0058.severity = silent
66+
67+
# IDE0065: Using directives must be placed outside of a namespace declaration
68+
# Can remove the below entry and turn it into a warning once https://github.com/dotnet/roslyn/issues/43271 is resolved.
69+
dotnet_diagnostic.IDE0065.severity = silent
70+
71+
# IDE0072: Populate switch
72+
dotnet_diagnostic.IDE0072.severity = silent
73+
74+
# IDE0083: Use pattern matching
75+
dotnet_diagnostic.IDE0083.severity = silent
76+
77+
# IDE0120: Simplify linq expression
78+
dotnet_diagnostic.IDE0120.severity = silent
79+
80+
# IDE0130: Namespace does not match folder structure
81+
dotnet_diagnostic.IDE0130.severity = silent
82+
83+
# IDE0150: Null check can be clarified
84+
dotnet_diagnostic.IDE0150.severity = silent
85+
86+
### Configuration for Microsoft.CodeAnalysis.NetAnalyzers analyzers executed on this repo ###
87+
88+
# CA1002: Do not expose generic lists
89+
dotnet_diagnostic.CA1002.severity = suggestion
90+
91+
# CA1024: Use properties where appropriate
92+
dotnet_diagnostic.CA1024.severity = suggestion
93+
94+
# CA1033: Interface methods should be callable by child types
95+
dotnet_diagnostic.CA1033.severity = suggestion
96+
97+
# ValidateArgumentsOfPublicMethods - only useful for libraries with supported public API surface, we don't have any
98+
dotnet_diagnostic.CA1062.severity = none
99+
100+
# CA1307: Specify StringComparison for clarity
101+
dotnet_diagnostic.CA1307.severity = suggestion
102+
103+
# CA1711: Identifiers should not have incorrect suffix
104+
dotnet_diagnostic.CA1711.severity = suggestion
105+
106+
# CA1309: Use ordinal string comparison
107+
dotnet_diagnostic.CA1309.severity = suggestion
108+
109+
# 🐢 Avoid dead conditional code: https://github.com/dotnet/roslyn-analyzers/issues/4914
110+
dotnet_diagnostic.CA1508.severity = none
111+
112+
# 🐢 Dispose objects before losing scope: https://github.com/dotnet/roslyn-analyzers/issues/4915
113+
dotnet_diagnostic.CA2000.severity = none
114+
115+
### Configuration for vs-threading analyzers executed on this repo ###
116+
117+
# VSTHRD002: Avoid problematic synchronous waits
118+
dotnet_diagnostic.VSTHRD002.severity = none
119+
120+
# VSTHRD011: Use AsyncLazy<T>
121+
dotnet_diagnostic.VSTHRD011.severity = none
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
is_global = true
2+
3+
### Configuration for RSxxxx rules ###
4+
5+
# Do not declare static members on generic types (we use generic static classes in test helpers)
6+
dotnet_diagnostic.CA1000.severity = none
7+
8+
# Nested types should not be visible (we use nested types as test helpers)
9+
dotnet_diagnostic.CA1034.severity = none
10+
11+
# IdentifiersShouldNotContainUnderscores - test names contain underscores and this is fine
12+
dotnet_diagnostic.CA1707.severity = none
13+
14+
# Type names should not match namespaces (not needed for test code)
15+
dotnet_diagnostic.CA1724.severity = none
16+
17+
# Mark member as static rule has many violations in non-shipping projects
18+
dotnet_diagnostic.CA1822.severity = none
19+
20+
# Do not directly await a Task (makes tests unnecessarily noisy)
21+
dotnet_diagnostic.CA2007.severity = none
22+
23+
# Do not call 'GetTestAccessor()'
24+
dotnet_diagnostic.RS0043.severity = none
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
is_global = true
2+
3+
# DoNotPassLiteralsAsLocalizedParameters - primarily useful for libraries where public APIs throw exceptions, and the messages need to be localized
4+
dotnet_diagnostic.CA1303.severity = none

src/Directory.Build.props

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,4 @@
5353
</ItemGroup>
5454
</Otherwise>
5555
</Choose>
56-
57-
<!-- Setup the correct code analysis rulesets -->
58-
<Choose>
59-
<When Condition="'$(IsTestProject)' == 'true' or '$(NonShipping)' == 'true'">
60-
<PropertyGroup>
61-
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)..\eng\Analyzers_NonShippingRules.ruleset</CodeAnalysisRuleSet>
62-
</PropertyGroup>
63-
</When>
64-
<Otherwise>
65-
<PropertyGroup>
66-
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)..\eng\Analyzers_ShippingRules.ruleset</CodeAnalysisRuleSet>
67-
</PropertyGroup>
68-
</Otherwise>
69-
</Choose>
7056
</Project>

0 commit comments

Comments
 (0)