Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
93 changes: 0 additions & 93 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@ root = true
indent_style = space
# (Please don't specify an indent_size here; that has too many unintended consequences.)

# RS1024: Compare symbols correctly
# https://github.com/dotnet/roslyn-analyzers/issues/3389
dotnet_diagnostic.RS1024.severity = none

# IDE0078: Use pattern matching
# https://github.com/dotnet/roslyn/issues/51691
# https://github.com/dotnet/roslyn/issues/51693
dotnet_diagnostic.IDE0078.severity = silent

# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4
Expand Down Expand Up @@ -181,67 +172,9 @@ visual_basic_style_unused_value_assignment_preference = unused_local_variable:wa
### Configuration for IDE code style by diagnostic IDs ###
[*.{cs,vb}]

# Default severity for all IDE code style rules with category 'Style'
dotnet_analyzer_diagnostic.category-Style.severity = warning

# Default severity for all IDE code quality rules with category 'CodeQuality'
dotnet_analyzer_diagnostic.category-CodeQuality.severity = warning

# IDE0066: Convert switch statement to expression
dotnet_diagnostic.IDE0066.severity = suggestion

# IDE0073: File header
file_header_template = Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information.

# IDE0001: Name can be simplified
dotnet_diagnostic.IDE0001.severity = silent

# IDE0002: Name can be simplified
dotnet_diagnostic.IDE0002.severity = silent

# IDE0003: Name can be simplified
dotnet_diagnostic.IDE0003.severity = silent

# IDE0007: Use 'var' instead of explicit type
dotnet_diagnostic.IDE0007.severity = silent

# IDE0010: Add missing cases in switch statement
dotnet_diagnostic.IDE0010.severity = silent

# IDE0017: Object initialization can be simplified
dotnet_diagnostic.IDE0017.severity = silent

# IDE0045: 'if' statement can be simplified
dotnet_diagnostic.IDE0045.severity = silent

# IDE0046: 'if' statement can be simplified
dotnet_diagnostic.IDE0046.severity = silent

# IDE0048: Parentheses should be added for clarity
dotnet_diagnostic.IDE0048.severity = silent

# IDE0058: Expression value is never used
dotnet_diagnostic.IDE0058.severity = silent

# IDE0065: Using directives must be placed outside of a namespace declaration
# Can remove the below entry and turn it into a warning once https://github.com/dotnet/roslyn/issues/43271 is resolved.
dotnet_diagnostic.IDE0065.severity = silent

# IDE0072: Populate switch
dotnet_diagnostic.IDE0072.severity = silent

# IDE0083: Use pattern matching
dotnet_diagnostic.IDE0083.severity = silent

# IDE0120: Simplify linq expression
dotnet_diagnostic.IDE0120.severity = silent

# IDE0130: Namespace does not match folder structure
dotnet_diagnostic.IDE0130.severity = silent

# IDE0150: Null check can be clarified
dotnet_diagnostic.IDE0150.severity = silent

# IDE2000: Allow multiple blank lines
dotnet_style_allow_multiple_blank_lines_experimental = false

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

# CA1002: Do not expose generic lists
dotnet_diagnostic.CA1002.severity = suggestion

# CA1024: Use properties where appropriate
dotnet_diagnostic.CA1024.severity = suggestion

# CA1033: Interface methods should be callable by child types
dotnet_diagnostic.CA1033.severity = suggestion

# CA1307: Specify StringComparison for clarity
dotnet_diagnostic.CA1307.severity = suggestion

# CA1711: Identifiers should not have incorrect suffix
dotnet_diagnostic.CA1711.severity = suggestion

# CA1309: Use ordinal string comparison
dotnet_diagnostic.CA1309.severity = suggestion

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

# Analyzers bail-out if the PublicAPI.*.txt file is not found
dotnet_public_api_analyzer.require_api_files = true

### Configuration for vs-threading analyzers executed on this repo ###
[*.{cs,vb}]

# VSTHRD002: Avoid problematic synchronous waits
dotnet_diagnostic.VSTHRD002.severity = none

# VSTHRD011: Use AsyncLazy<T>
dotnet_diagnostic.VSTHRD011.severity = none
12 changes: 11 additions & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@
<ExcludeByFile></ExcludeByFile>
</PropertyGroup>

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

<Target Name="OuterInstrumentModulesNoBuild" BeforeTargets="RunTests" Condition="'$(IsUnitTestProject)' == 'true' AND '$(TargetFramework)' == ''">
<MSBuild
Projects="$(MSBuildProjectFullPath)"
Expand All @@ -73,4 +83,4 @@
BeforeTargets="Test"
DependsOnTargets="GenerateCoverageResult"
Condition="'$(IsUnitTestProject)' == 'true' AND '$(TargetFramework)' != '' AND '$(CollectCoverage)' == 'true'" />
</Project>
</Project>
40 changes: 0 additions & 40 deletions eng/Analyzers_NonShippingRules.ruleset

This file was deleted.

41 changes: 0 additions & 41 deletions eng/Analyzers_ShippingRules.ruleset

This file was deleted.

121 changes: 121 additions & 0 deletions eng/globalconfigs/Common.globalconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
is_global = true

# Default severity for all IDE code style rules with category 'Style'
dotnet_analyzer_diagnostic.category-Style.severity = warning

# Default severity for all IDE code quality rules with category 'CodeQuality'
dotnet_analyzer_diagnostic.category-CodeQuality.severity = warning

### Configuration for RSxxxx rules ###

# RS1024: Compare symbols correctly
# https://github.com/dotnet/roslyn-analyzers/issues/3389
dotnet_diagnostic.RS1024.severity = none

# Parts exported with MEFv2 must be marked with 'SharedAttribute', un-needed here
dotnet_diagnostic.RS0023.severity = none

# Exported parts should be marked with 'ImportingConstructorAttribute', un-needed here
dotnet_diagnostic.RS0034.severity = none

# Use 'null' instead of 'default' for nullable types
dotnet_diagnostic.RS0038.severity = none

# TODO: Remove this exclusion and fix related issues, tracked by https://github.com/dotnet/roslyn-analyzers/issues/3915
#dotnet_diagnostic.RS0041.severity = none

### Configuration for IDE code style by diagnostic IDs ###

# IDE0078: Use pattern matching
# https://github.com/dotnet/roslyn/issues/51691
# https://github.com/dotnet/roslyn/issues/51693
dotnet_diagnostic.IDE0078.severity = silent

# IDE0066: Convert switch statement to expression
dotnet_diagnostic.IDE0066.severity = suggestion

# IDE0001: Name can be simplified
dotnet_diagnostic.IDE0001.severity = silent

# IDE0002: Name can be simplified
dotnet_diagnostic.IDE0002.severity = silent

# IDE0003: Name can be simplified
dotnet_diagnostic.IDE0003.severity = silent

# IDE0007: Use 'var' instead of explicit type
dotnet_diagnostic.IDE0007.severity = silent

# IDE0010: Add missing cases in switch statement
dotnet_diagnostic.IDE0010.severity = silent

# IDE0017: Object initialization can be simplified
dotnet_diagnostic.IDE0017.severity = silent

# IDE0045: 'if' statement can be simplified
dotnet_diagnostic.IDE0045.severity = silent

# IDE0046: 'if' statement can be simplified
dotnet_diagnostic.IDE0046.severity = silent

# IDE0048: Parentheses should be added for clarity
dotnet_diagnostic.IDE0048.severity = silent

# IDE0058: Expression value is never used
dotnet_diagnostic.IDE0058.severity = silent

# IDE0065: Using directives must be placed outside of a namespace declaration
# Can remove the below entry and turn it into a warning once https://github.com/dotnet/roslyn/issues/43271 is resolved.
dotnet_diagnostic.IDE0065.severity = silent

# IDE0072: Populate switch
dotnet_diagnostic.IDE0072.severity = silent

# IDE0083: Use pattern matching
dotnet_diagnostic.IDE0083.severity = silent

# IDE0120: Simplify linq expression
dotnet_diagnostic.IDE0120.severity = silent

# IDE0130: Namespace does not match folder structure
dotnet_diagnostic.IDE0130.severity = silent

# IDE0150: Null check can be clarified
dotnet_diagnostic.IDE0150.severity = silent

### Configuration for Microsoft.CodeAnalysis.NetAnalyzers analyzers executed on this repo ###

# CA1002: Do not expose generic lists
dotnet_diagnostic.CA1002.severity = suggestion

# CA1024: Use properties where appropriate
dotnet_diagnostic.CA1024.severity = suggestion

# CA1033: Interface methods should be callable by child types
dotnet_diagnostic.CA1033.severity = suggestion

# ValidateArgumentsOfPublicMethods - only useful for libraries with supported public API surface, we don't have any
dotnet_diagnostic.CA1062.severity = none

# CA1307: Specify StringComparison for clarity
dotnet_diagnostic.CA1307.severity = suggestion

# CA1711: Identifiers should not have incorrect suffix
dotnet_diagnostic.CA1711.severity = suggestion

# CA1309: Use ordinal string comparison
dotnet_diagnostic.CA1309.severity = suggestion

# 🐢 Avoid dead conditional code: https://github.com/dotnet/roslyn-analyzers/issues/4914
dotnet_diagnostic.CA1508.severity = none

# 🐢 Dispose objects before losing scope: https://github.com/dotnet/roslyn-analyzers/issues/4915
dotnet_diagnostic.CA2000.severity = none

### Configuration for vs-threading analyzers executed on this repo ###

# VSTHRD002: Avoid problematic synchronous waits
dotnet_diagnostic.VSTHRD002.severity = none

# VSTHRD011: Use AsyncLazy<T>
dotnet_diagnostic.VSTHRD011.severity = none
24 changes: 24 additions & 0 deletions eng/globalconfigs/NonShipping.globalconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
is_global = true

# Do not declare static members on generic types (we use generic static classes in test helpers)
dotnet_diagnostic.CA1000.severity = none

# Nested types should not be visible (we use nested types as test helpers)
dotnet_diagnostic.CA1034.severity = none

# IdentifiersShouldNotContainUnderscores - test names contain underscores and this is fine
dotnet_diagnostic.CA1707.severity = none

# Type names should not match namespaces (not needed for test code)
dotnet_diagnostic.CA1724.severity = none

# Mark member as static rule has many violations in non-shipping projects
dotnet_diagnostic.CA1822.severity = none

# Do not directly await a Task (makes tests unnecessarily noisy)
dotnet_diagnostic.CA2007.severity = none

### Configuration for RSxxxx rules ###

# Do not call 'GetTestAccessor()'
dotnet_diagnostic.RS0043.severity = none
4 changes: 4 additions & 0 deletions eng/globalconfigs/Shipping.globalconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
is_global = true

# DoNotPassLiteralsAsLocalizedParameters - primarily useful for libraries where public APIs throw exceptions, and the messages need to be localized
dotnet_diagnostic.CA1303.severity = none
14 changes: 0 additions & 14 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,4 @@
</ItemGroup>
</Otherwise>
</Choose>

<!-- Setup the correct code analysis rulesets -->
<Choose>
<When Condition="'$(IsTestProject)' == 'true' or '$(NonShipping)' == 'true'">
<PropertyGroup>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)..\eng\Analyzers_NonShippingRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)..\eng\Analyzers_ShippingRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
</Otherwise>
</Choose>
</Project>
Loading