Links
Those rules are enabled by default.
Edit the project file to enable additional rules:
MyProject.csproj
|
<PropertyGroup>
<!-- ... -->
<AnalysisLevel>latest-recommended</AnalysisLevel>
</PropertyGroup>
|
Editorconfig
Core options
.editorconfig
|
###############################
# Core EditorConfig Options #
###############################
root = true
# All files
[*]
indent_style = space
insert_final_newline = true
charset = utf-8
# XML project files
[*.csproj]
indent_size = 2
# JSON config files
[*.json]
indent_size = 2
# C# code files
[*.cs]
indent_size = 4
trim_trailing_whitespace = true
|
Style configuration
.editorconfig
|
###############################
# Style configuration #
###############################
# IDE0011: Add braces
csharp_prefer_braces = when_multiline
# IDE0022: Use expression body for methods
csharp_style_expression_bodied_methods = when_on_single_line
# IDE0160 / IDE0161: Namespace declaration preferences
csharp_style_namespace_declarations = file_scoped : error
|
Disable rules
.editorconfig
|
###############################
# Disabled rules #
###############################
# lower speller rule severity to suggestion
dotnet_diagnostic.VSSpell001.severity = suggestion
dotnet_diagnostic.VSSpell002.severity = suggestion
# IDE0046: Use conditional expression for return
dotnet_diagnostic.IDE0046.severity = suggestion
# IDE0058: Remove unnecessary expression value
dotnet_diagnostic.IDE0058.severity = none
# CA1305: Specify IFormatProvider
dotnet_diagnostic.CA1305.severity = none
# CA1310: Specify StringComparison for correctness
dotnet_diagnostic.CA1310.severity = none
# Specify CultureInfo
dotnet_diagnostic.CA1304.severity = suggestion
# Specify a culture
dotnet_diagnostic.CA1311.severity = suggestion
|