Skip to content

Commit bad1e3c

Browse files
authored
Merge pull request #6367 from Youssef1313/cleanup-rulesets
Remove rulesets
2 parents 5a425e7 + 0386078 commit bad1e3c

File tree

21 files changed

+170
-222
lines changed

21 files changed

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