Enforce additional style rules.
This commit is contained in:
@@ -123,6 +123,7 @@ dotnet_style_predefined_type_for_locals_parameters_members = true
|
|||||||
|
|
||||||
# Use expression body for some items if on a single line.
|
# Use expression body for some items if on a single line.
|
||||||
csharp_style_expression_bodied_local_functions = when_on_single_line
|
csharp_style_expression_bodied_local_functions = when_on_single_line
|
||||||
|
csharp_style_expression_bodied_accessors = when_on_single_line
|
||||||
|
|
||||||
# This rule is buggy and not enforced for builds. ':warning' will at least enforce it in the IDE.
|
# This rule is buggy and not enforced for builds. ':warning' will at least enforce it in the IDE.
|
||||||
csharp_style_expression_bodied_lambdas = when_on_single_line:warning
|
csharp_style_expression_bodied_lambdas = when_on_single_line:warning
|
||||||
@@ -136,6 +137,9 @@ dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary
|
|||||||
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
|
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
|
||||||
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
|
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
|
||||||
|
|
||||||
|
# This is the default, but the rule (IDE1005) is not triggered if this is not specified.
|
||||||
|
csharp_style_conditional_delegate_call = true
|
||||||
|
|
||||||
## Others:
|
## Others:
|
||||||
|
|
||||||
# Show an IDE warning when default access modifiers are explicitly specified.
|
# Show an IDE warning when default access modifiers are explicitly specified.
|
||||||
@@ -147,12 +151,24 @@ dotnet_diagnostic.IDE0001.severity = warning
|
|||||||
# Simplify member access.
|
# Simplify member access.
|
||||||
dotnet_diagnostic.IDE0002.severity = warning
|
dotnet_diagnostic.IDE0002.severity = warning
|
||||||
|
|
||||||
|
# Remove 'this' or 'Me' qualification.
|
||||||
|
dotnet_diagnostic.IDE0003.severity = warning
|
||||||
|
|
||||||
# Remove unnecessary cast.
|
# Remove unnecessary cast.
|
||||||
dotnet_diagnostic.IDE0004.severity = warning
|
dotnet_diagnostic.IDE0004.severity = warning
|
||||||
|
|
||||||
|
# Remove unnecessary import.
|
||||||
|
dotnet_diagnostic.IDE0005.severity = warning
|
||||||
|
|
||||||
# Use 'var' instead of explicit type.
|
# Use 'var' instead of explicit type.
|
||||||
dotnet_diagnostic.IDE0007.severity = warning
|
dotnet_diagnostic.IDE0007.severity = warning
|
||||||
|
|
||||||
|
# Use explicit type instead of 'var'.
|
||||||
|
dotnet_diagnostic.IDE0008.severity = warning
|
||||||
|
|
||||||
|
# Add 'this' or 'Me' qualification.
|
||||||
|
dotnet_diagnostic.IDE0009.severity = warning
|
||||||
|
|
||||||
# Don't prefer braces (for one liners).
|
# Don't prefer braces (for one liners).
|
||||||
dotnet_diagnostic.IDE0011.severity = silent
|
dotnet_diagnostic.IDE0011.severity = silent
|
||||||
|
|
||||||
@@ -168,6 +184,9 @@ dotnet_diagnostic.IDE0019.severity = warning
|
|||||||
# Use pattern matching to avoid 'is' check followed by a cast (with variable).
|
# Use pattern matching to avoid 'is' check followed by a cast (with variable).
|
||||||
dotnet_diagnostic.IDE0020.severity = warning
|
dotnet_diagnostic.IDE0020.severity = warning
|
||||||
|
|
||||||
|
# Use expression body for accessors.
|
||||||
|
dotnet_diagnostic.IDE0027.severity = warning
|
||||||
|
|
||||||
# Collection initialization can be simplified.
|
# Collection initialization can be simplified.
|
||||||
dotnet_diagnostic.IDE0028.severity = warning
|
dotnet_diagnostic.IDE0028.severity = warning
|
||||||
|
|
||||||
@@ -216,6 +235,9 @@ dotnet_diagnostic.IDE0047.severity = warning
|
|||||||
# Add parentheses for clarity.
|
# Add parentheses for clarity.
|
||||||
dotnet_diagnostic.IDE0048.severity = warning
|
dotnet_diagnostic.IDE0048.severity = warning
|
||||||
|
|
||||||
|
# Use language keywords instead of framework type names for type references.
|
||||||
|
dotnet_diagnostic.IDE0049.severity = warning
|
||||||
|
|
||||||
# Remove unused private member.
|
# Remove unused private member.
|
||||||
dotnet_diagnostic.IDE0051.severity = warning
|
dotnet_diagnostic.IDE0051.severity = warning
|
||||||
|
|
||||||
@@ -237,12 +259,30 @@ dotnet_diagnostic.IDE0060.severity = warning
|
|||||||
# Use expression body for local functions.
|
# Use expression body for local functions.
|
||||||
dotnet_diagnostic.IDE0061.severity = warning
|
dotnet_diagnostic.IDE0061.severity = warning
|
||||||
|
|
||||||
|
# Make struct fields writable.
|
||||||
|
dotnet_diagnostic.IDE0064.severity = warning
|
||||||
|
|
||||||
|
# Use 'System.HashCode.Combine'.
|
||||||
|
dotnet_diagnostic.IDE0070.severity = warning
|
||||||
|
|
||||||
# Simplify interpolation.
|
# Simplify interpolation.
|
||||||
dotnet_diagnostic.IDE0071.severity = warning
|
dotnet_diagnostic.IDE0071.severity = warning
|
||||||
|
|
||||||
# Simplify conditional expression.
|
# Simplify conditional expression.
|
||||||
dotnet_diagnostic.IDE0075.severity = warning
|
dotnet_diagnostic.IDE0075.severity = warning
|
||||||
|
|
||||||
|
# Remove invalid global 'SuppressMessageAttribute'.
|
||||||
|
dotnet_diagnostic.IDE0076.severity = warning
|
||||||
|
|
||||||
|
# Avoid legacy format target in global 'SuppressMessageAttribute'.
|
||||||
|
dotnet_diagnostic.IDE0077.severity = warning
|
||||||
|
|
||||||
|
# Remove unnecessary suppression.
|
||||||
|
dotnet_diagnostic.IDE0079.severity = warning
|
||||||
|
|
||||||
|
# Remove unnecessary suppression operator.
|
||||||
|
dotnet_diagnostic.IDE0080.severity = warning
|
||||||
|
|
||||||
# Convert typeof to nameof.
|
# Convert typeof to nameof.
|
||||||
dotnet_diagnostic.IDE0082.severity = warning
|
dotnet_diagnostic.IDE0082.severity = warning
|
||||||
|
|
||||||
@@ -252,12 +292,21 @@ dotnet_diagnostic.IDE0100.severity = warning
|
|||||||
# Simplify LINQ expression.
|
# Simplify LINQ expression.
|
||||||
dotnet_diagnostic.IDE0120.severity = warning
|
dotnet_diagnostic.IDE0120.severity = warning
|
||||||
|
|
||||||
|
# Use block-scoped namespace.
|
||||||
|
dotnet_diagnostic.IDE0160.severity = warning
|
||||||
|
|
||||||
|
# Use file-scoped namespace.
|
||||||
|
dotnet_diagnostic.IDE0161.severity = warning
|
||||||
|
|
||||||
# Use tuple to swap values.
|
# Use tuple to swap values.
|
||||||
dotnet_diagnostic.IDE0180.severity = warning
|
dotnet_diagnostic.IDE0180.severity = warning
|
||||||
|
|
||||||
# Make struct 'readonly'.
|
# Make struct 'readonly'.
|
||||||
dotnet_diagnostic.IDE0250.severity = warning
|
dotnet_diagnostic.IDE0250.severity = warning
|
||||||
|
|
||||||
|
# Use conditional delegate call.
|
||||||
|
dotnet_diagnostic.IDE1005.severity = warning
|
||||||
|
|
||||||
# Naming rule violation.
|
# Naming rule violation.
|
||||||
dotnet_diagnostic.IDE1006.severity = warning
|
dotnet_diagnostic.IDE1006.severity = warning
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user