# This .editorconfig file is configured in an opt-out fashion. This means that the default severity of diagnostic analyzers is set to warning
# and for some diagnostics their severity is reduced.
#
# Be **careful** editing this because some of the rules don't support adding a severity level
# For instance if you change to `dotnet_sort_system_directives_first = true:warning` (adding `:warning`)
# then the rule will be silently ignored. Always test when making changes to this file
#

##########################################
# Common Settings
##########################################

# This file is the top-most EditorConfig file
root = true

# All Files
[*]
charset = utf-8
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

##########################################
# File Extension Settings
##########################################

# Visual Studio Solution Files
[*.sln]
indent_style = tab

# Visual Studio XML Project Files
[*.{csproj,vbproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2

# XML Configuration Files
[*.{xml,config,props,targets,nuspec,resx,ruleset,vsixmanifest,vsct}]
indent_size = 2

# JSON Files
[*.{json,json5,webmanifest}]
indent_size = 2

# YAML Files
[*.{yml,yaml}]
indent_size = 2

# Markdown Files
[*.md]
trim_trailing_whitespace = false

# Web Files
[*.{htm,html,js,jsm,ts,tsx,css,sass,scss,less,pcss,svg,vue}]
indent_size = 2

# Batch Files
[*.{cmd,bat}]
end_of_line = crlf

# Bash Files
[*.sh]
end_of_line = lf

# Makefiles
[Makefile]
indent_style = tab

##########################################
# Default .NET Code Style Severities
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/configuration-options#scope
##########################################
[*.cs]
# Default Severity for all .NET Code Style rules below
dotnet_analyzer_diagnostic.severity = warning

##########################################
# Code quality rules https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/
# .NET code analysis provides rules that aim to improve code quality. The rules are organized into areas
# such as design, globalization, performance, and security. Certain rules are specific to .NET API usage,
# while others are about generic code quality.
#
# The following is an opt out configuration for setting AnalysisMode to AllEnabledByDefault.
# This is the most aggressive mode. All rules are enabled as build warnings. You can selectively opt out
# of individual rules to disable them.
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/overview#enable-additional-rules
##########################################
[*.cs]
# Design rules https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/design-warnings
dotnet_diagnostic.CA1014.severity = none        # CA1014: Mark assemblies with CLSCompliantAttribute
dotnet_diagnostic.CA1030.severity = silent      # CA1030: Use events where appropriate
dotnet_diagnostic.CA1032.severity = none        # CA1032: Implement standard exception constructors
dotnet_diagnostic.CA1054.severity = none        # CA1054: URI parameters should not be strings
dotnet_diagnostic.CA1056.severity = none        # CA1056: URI properties should not be strings
# Globalization rules https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/globalization-warnings
dotnet_diagnostic.CA1303.severity = none        # CA1303: Do not pass literals as localized parameters
dotnet_diagnostic.CA1308.severity = none        # CA1308: Normalize strings to uppercase
# Maintainability rules https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/maintainability-warnings
dotnet_diagnostic.CA1508.severity = none        # CA1508: Avoid dead conditional code # This one seems to flag false positives in some cases
# Naming rules https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/naming-warnings
dotnet_diagnostic.CA1711.severity = none        # CA1711: Identifiers should not have incorrect suffix
# Reliability rules https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/reliability-warnings
dotnet_diagnostic.CA2007.severity = none        # CA2007: Do not directly await a Task
# Usage rules https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/usage-warnings
dotnet_diagnostic.CA2234.severity = silent      # CA2234: Pass System.Uri objects instead of strings

##########################################
# .NET code refactoring options
# https://learn.microsoft.com/en-us/visualstudio/ide/reference/code-styles-refactoring-options?view=vs-2022
##########################################
[*.cs]
dotnet_style_operator_placement_when_wrapping = beginning_of_line

##########################################
# Language and unnecessary rules
# https://learn.microsoft.com/en-gb/dotnet/fundamentals/code-analysis/style-rules/language-rules
##########################################
[*.cs]

# Code-block preferences https://learn.microsoft.com/en-gb/dotnet/fundamentals/code-analysis/style-rules/language-rules#code-block-preferences
dotnet_diagnostic.IDE0290.severity = silent             # Use primary constructor (IDE0290)

# Expression-bodied members https://learn.microsoft.com/en-gb/dotnet/fundamentals/code-analysis/style-rules/language-rules#expression-bodied-members
csharp_style_expression_bodied_methods = true:silent
dotnet_diagnostic.IDE0022.severity = silent             # Use expression body for methods (IDE0022)
csharp_style_expression_bodied_operators = true:silent
dotnet_diagnostic.IDE0023.severity = silent             # IDE0023: Use expression body for conversion operators
csharp_style_expression_bodied_properties = true:silent
dotnet_diagnostic.IDE0025.severity = silent             # Use expression body for properties (IDE0025)
csharp_style_expression_bodied_indexers = true:silent
dotnet_diagnostic.IDE0026.severity = silent             # Use expression body for indexers (IDE0026)
csharp_style_expression_bodied_accessors = true:silent
dotnet_diagnostic.IDE0027.severity = silent             # Use expression body for accessors (IDE0027)
csharp_style_expression_bodied_lambdas = true:silent
dotnet_diagnostic.IDE0053.severity = silent             # Use expression body for lambdas (IDE0053)
csharp_style_expression_bodied_local_functions = true:silent
dotnet_diagnostic.IDE0061.severity = silent             # Use expression body for local functions (IDE0061)

# Expression-level preferences https://learn.microsoft.com/en-gb/dotnet/fundamentals/code-analysis/style-rules/language-rules#expression-level-preferences
dotnet_diagnostic.IDE0010.severity = silent     # Add missing cases to switch statement (IDE0010)
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_diagnostic.IDE0045.severity = suggestion # Use conditional expression for assignment (IDE0045)
dotnet_style_prefer_conditional_expression_over_return = true:silent
dotnet_diagnostic.IDE0046.severity = none       # Use conditional expression for return (IDE0046)
dotnet_diagnostic.IDE0057.severity = none                # Use range operator (IDE0057)
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
dotnet_diagnostic.IDE0058.severity = silent     # Remove unnecessary expression value (IDE0058)
csharp_style_implicit_object_creation_when_type_is_apparent = false:silent
dotnet_diagnostic.IDE0090.severity = suggestion          # Simplify new expression (IDE0090)

# Parentheses preferences https://learn.microsoft.com/en-gb/dotnet/fundamentals/code-analysis/style-rules/language-rules#parentheses-preferences
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion

# 'var' preferences https://learn.microsoft.com/en-gb/dotnet/fundamentals/code-analysis/style-rules/language-rules#var-preferences
dotnet_diagnostic.IDE0008.severity = none               # IDE0008: Use explicit type instead of 'var'
csharp_style_var_for_built_in_types = true:warning
csharp_style_var_when_type_is_apparent = true:warning
csharp_style_var_elsewhere = true:warning

##########################################
# Formatting Rules
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules
##########################################

# .NET formatting rules
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#net-formatting-rules
[*.cs]
dotnet_diagnostic.IDE0055.severity = suggestion    # Rule ID: "IDE0055" (Fix formatting)
# Organize using directives
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false

# C# formatting rules
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#c-formatting-rules
[*.cs]
# Newline options
# https://docs.microsoft.com/visualstudio/ide/editorconfig-formatting-conventions#new-line-options
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
csharp_style_namespace_declarations = file_scoped
# Indentation options
# https://docs.microsoft.com/visualstudio/ide/editorconfig-formatting-conventions#indentation-options
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents_when_block = false
# Spacing options
# https://docs.microsoft.com/visualstudio/ide/editorconfig-formatting-conventions#spacing-options
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_parentheses = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_around_binary_operators = before_and_after
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_after_comma = true
csharp_space_before_comma = false
csharp_space_after_dot = false
csharp_space_before_dot = false
csharp_space_after_semicolon_in_for_statement = true
csharp_space_before_semicolon_in_for_statement = false
csharp_space_around_declaration_statements = false
csharp_space_before_open_square_brackets = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_square_brackets = false
# Wrap options
# https://docs.microsoft.com/visualstudio/ide/editorconfig-formatting-conventions#wrap-options
csharp_preserve_single_line_statements = false
csharp_preserve_single_line_blocks = true

##########################################
# .NET Naming Rules
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/naming-rules
# Some of the naming rules as based on https://github.com/RehanSaeed/EditorConfig/blob/7b1927edffbe299873225026f61ac1ee7ae743e7/.editorconfig
##########################################
[*.cs]

##########################################
# Styles
##########################################
# camel_case_style_with_underscore_prefix
dotnet_naming_style.camel_case_with_underscore_style.capitalization = camel_case
dotnet_naming_style.camel_case_with_underscore_style.required_prefix = _
# camel_case_style - Define the camelCase style
dotnet_naming_style.camel_case_style.capitalization = camel_case
# pascal_case_style - Define the PascalCase style
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
# prefix_interface_with_i_style - Interfaces must be PascalCase and the first character of an interface must be an 'I'
dotnet_naming_style.prefix_interface_with_i_style.capitalization = pascal_case
dotnet_naming_style.prefix_interface_with_i_style.required_prefix = I
# prefix_type_parameters_with_t_style - Generic Type Parameters must be PascalCase and the first character must be a 'T'
dotnet_naming_style.prefix_type_parameters_with_t_style.capitalization = pascal_case
dotnet_naming_style.prefix_type_parameters_with_t_style.required_prefix = T
# disallowed_style - Anything that has this style applied is marked as disallowed
dotnet_naming_style.disallowed_style.capitalization  = pascal_case
dotnet_naming_style.disallowed_style.required_prefix = ____RULE_VIOLATION____
dotnet_naming_style.disallowed_style.required_suffix = ____RULE_VIOLATION____
# internal_error_style - This style should never occur... if it does, it indicates a bug in file or in the parser using the file
dotnet_naming_style.internal_error_style.capitalization  = pascal_case
dotnet_naming_style.internal_error_style.required_prefix = ____INTERNAL_ERROR____
dotnet_naming_style.internal_error_style.required_suffix = ____INTERNAL_ERROR____

##########################################
# .NET Design Guideline Field Naming Rules
# Naming rules for fields follow the .NET Framework design guidelines
# https://docs.microsoft.com/dotnet/standard/design-guidelines/index
##########################################

# All public/protected/protected_internal constant fields must be PascalCase
# modified to all public/internal constant fields must be PascalCase
# https://docs.microsoft.com/dotnet/standard/design-guidelines/field
dotnet_naming_symbols.public_protected_constant_fields_group.applicable_accessibilities = public, internal
dotnet_naming_symbols.public_protected_constant_fields_group.required_modifiers         = const
dotnet_naming_symbols.public_protected_constant_fields_group.applicable_kinds           = field
dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.symbols    = public_protected_constant_fields_group
dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.style      = pascal_case_style
dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.severity   = warning

# All public/protected/protected_internal static readonly fields must be PascalCase
# https://docs.microsoft.com/dotnet/standard/design-guidelines/field
dotnet_naming_symbols.public_protected_static_readonly_fields_group.applicable_accessibilities = public, protected, protected_internal
dotnet_naming_symbols.public_protected_static_readonly_fields_group.required_modifiers         = static, readonly
dotnet_naming_symbols.public_protected_static_readonly_fields_group.applicable_kinds           = field
dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.symbols    = public_protected_static_readonly_fields_group
dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.style      = pascal_case_style
dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.severity   = warning

# No other public/protected/protected_internal fields are allowed
# https://docs.microsoft.com/dotnet/standard/design-guidelines/field
dotnet_naming_symbols.other_public_protected_fields_group.applicable_accessibilities = public, protected, protected_internal
dotnet_naming_symbols.other_public_protected_fields_group.applicable_kinds           = field
dotnet_naming_rule.other_public_protected_fields_disallowed_rule.symbols             = other_public_protected_fields_group
dotnet_naming_rule.other_public_protected_fields_disallowed_rule.style               = disallowed_style
dotnet_naming_rule.other_public_protected_fields_disallowed_rule.severity            = error

##########################################
# StyleCop Field Naming Rules
# Naming rules for fields follow the StyleCop analyzers
# This does not override any rules using disallowed_style above
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers
##########################################

# All constant fields must be PascalCase modified to
# All non public/internal constant fields must be _camelCase
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1303.md
dotnet_naming_symbols.stylecop_constant_fields_group.applicable_accessibilities = protected_internal, protected, private_protected, private
dotnet_naming_symbols.stylecop_constant_fields_group.required_modifiers         = const
dotnet_naming_symbols.stylecop_constant_fields_group.applicable_kinds           = field
dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.symbols    = stylecop_constant_fields_group
dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.style      = camel_case_with_underscore_style
dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.severity   = warning

# All static readonly fields must be PascalCase
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md
dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_accessibilities = public, internal, protected_internal, protected
dotnet_naming_symbols.stylecop_static_readonly_fields_group.required_modifiers         = static, readonly
dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_kinds           = field
dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.symbols    = stylecop_static_readonly_fields_group
dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.style      = pascal_case_style
dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.severity   = warning

# No non-private instance fields are allowed
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1401.md
dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected
dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_kinds           = field
dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.symbols               = stylecop_fields_must_be_private_group
dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.style                 = disallowed_style
dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.severity              = error

# Private fields must be _camelCase
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1306.md
dotnet_naming_symbols.stylecop_private_fields_group.applicable_accessibilities              = private
dotnet_naming_symbols.stylecop_private_fields_group.applicable_kinds                        = field
dotnet_naming_rule.stylecop_private_fields_must_be_camel_with_underscore_case_rule.symbols  = stylecop_private_fields_group
dotnet_naming_rule.stylecop_private_fields_must_be_camel_with_underscore_case_rule.style    = camel_case_with_underscore_style
dotnet_naming_rule.stylecop_private_fields_must_be_camel_with_underscore_case_rule.severity = warning

# Local variables must be camelCase
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1312.md
dotnet_naming_symbols.stylecop_local_fields_group.applicable_accessibilities = local
dotnet_naming_symbols.stylecop_local_fields_group.applicable_kinds           = local
dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.symbols     = stylecop_local_fields_group
dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.style       = camel_case_style
dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.severity    = warning

# This rule should never fire.  However, it's included for at least two purposes:
# First, it helps to understand, reason about, and root-case certain types of issues, such as bugs in .editorconfig parsers.
# Second, it helps to raise immediate awareness if a new field type is added (as occurred recently in C#).
dotnet_naming_symbols.sanity_check_uncovered_field_case_group.applicable_accessibilities = *
dotnet_naming_symbols.sanity_check_uncovered_field_case_group.applicable_kinds           = field
dotnet_naming_rule.sanity_check_uncovered_field_case_rule.symbols  = sanity_check_uncovered_field_case_group
dotnet_naming_rule.sanity_check_uncovered_field_case_rule.style    = internal_error_style
dotnet_naming_rule.sanity_check_uncovered_field_case_rule.severity = error

##########################################
# Other Naming Rules
##########################################

# All of the following must be PascalCase:
# - Namespaces
#   https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-namespaces
#   https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1300.md
# - Classes and Enumerations
#   https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces
#   https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1300.md
# - Delegates
#   https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces#names-of-common-types
# - Constructors, Properties, Events, Methods, Local Functions
#   https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-type-members
dotnet_naming_symbols.element_group.applicable_kinds = namespace, class, enum, struct, delegate, event, method, property, local_function
dotnet_naming_rule.element_rule.symbols              = element_group
dotnet_naming_rule.element_rule.style                = pascal_case_style
dotnet_naming_rule.element_rule.severity             = warning

# Interfaces use PascalCase and are prefixed with uppercase 'I'
# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces
dotnet_naming_symbols.interface_group.applicable_kinds = interface
dotnet_naming_rule.interface_rule.symbols              = interface_group
dotnet_naming_rule.interface_rule.style                = prefix_interface_with_i_style
dotnet_naming_rule.interface_rule.severity             = warning

# Generics Type Parameters use PascalCase and are prefixed with uppercase 'T'
# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces
dotnet_naming_symbols.type_parameter_group.applicable_kinds = type_parameter
dotnet_naming_rule.type_parameter_rule.symbols              = type_parameter_group
dotnet_naming_rule.type_parameter_rule.style                = prefix_type_parameters_with_t_style
dotnet_naming_rule.type_parameter_rule.severity             = warning

# Function parameters use camelCase
# https://docs.microsoft.com/dotnet/standard/design-guidelines/naming-parameters
dotnet_naming_symbols.parameters_group.applicable_kinds = parameter
dotnet_naming_rule.parameters_rule.symbols              = parameters_group
dotnet_naming_rule.parameters_rule.style                = camel_case_style
dotnet_naming_rule.parameters_rule.severity             = warning

##########################################
# Third party analyzers
##########################################

##########################################
# Rules for Meziantou.Analyzer
# See https://github.com/meziantou/Meziantou.Analyzer/tree/main/docs
##########################################
[*.cs]
dotnet_diagnostic.MA0004.severity = none    # MA0004 Use Task.ConfigureAwait(false)
dotnet_diagnostic.MA0011.severity = none    # MA0011 IFormatProvider is missing
dotnet_diagnostic.MA0032.severity = warning # MA0032 Use an overload with a CancellationToken argument
dotnet_diagnostic.MA0048.severity = none    # MA0048 File name must match type name
dotnet_diagnostic.MA0076.severity = none    # MA0076 Do not use implicit culture-sensitive ToString in interpolated strings
dotnet_diagnostic.MA0101.severity = none    # MA0101 String contains an implicit end of line character

##########################################
# Rules for Microsoft.VisualStudio.Threading.Analyzers
# See https://github.com/microsoft/vs-threading/blob/main/doc/analyzers/index.md
##########################################
[*.cs]
dotnet_diagnostic.VSTHRD111.severity = none         # VSTHRD111 Use .ConfigureAwait(bool)

##########################################
# Rules for Roslynator.Analyzers
# See https://github.com/JosefPihrt/Roslynator/blob/master/src/Analyzers/README.md
##########################################
[*.cs]
dotnet_diagnostic.RCS1090.severity = none           # RCS1090: Add call to 'ConfigureAwait' (or vice versa)
dotnet_diagnostic.RCS1194.severity = none           # RCS1194: Implement exception constructors
dotnet_diagnostic.RCS1224.severity = none           # RCS1224: Make method an extension method
dotnet_diagnostic.RCS1181.severity = none           # RCS1181: Convert comment to documentation comment
dotnet_diagnostic.RCS1140.severity = none           # RCS1140: Add exception to documentation comment
dotnet_diagnostic.RCS1161.severity = none           # RCS1161: Enum should declare explicit values
dotnet_diagnostic.RCS1238.severity = none           # RCS1238: Avoid nested ?: operators
dotnet_diagnostic.RCS1031.severity = suggestion     # RCS1031: Remove unnecessary braces
dotnet_diagnostic.RCS1032.severity = suggestion     # RCS1032: Remove redundant parentheses
dotnet_diagnostic.RCS1035.severity = none           # RCS1035: Remove redundant comma in initializer
dotnet_diagnostic.RCS1036.severity = suggestion     # RCS1036: Remove redundant empty line
dotnet_diagnostic.RCS1037.severity = suggestion     # RCS1037: Remove trailing white-space
dotnet_diagnostic.RCS1039.severity = suggestion     # RCS1039: Remove argument list from attribute
dotnet_diagnostic.RCS1070.severity = none           # RCS1070: Remove redundant default switch section	Redundancy	Hidden
dotnet_diagnostic.RCS1021.severity = none           # RCS1021: Convert lambda expression body to expression-body
dotnet_diagnostic.RCS1201.severity = none           # RCS1201: Use method chaining
dotnet_diagnostic.RCS1001.severity = suggestion     # RCS1001: Add braces (when expression spans over multiple lines)
dotnet_diagnostic.RCS1002.severity = none           # RCS1002: Remove braces
dotnet_diagnostic.RCS1003.severity = suggestion     # RCS1003: Add braces to if-else (when expression spans over multiple lines)
dotnet_diagnostic.RCS1004.severity = none           # RCS1004: Remove braces from if-else
dotnet_diagnostic.RCS1007.severity = suggestion     # RCS1007: Add braces
dotnet_diagnostic.RCS1017.severity = none           # RCS1017: [deprecated] Avoid multiline expression body
roslynator.RCS1050.invert = true
dotnet_diagnostic.RCS1050.severity = suggestion     # RCS1050: Add argument list to object creation expression (or vice versa)
dotnet_diagnostic.RCS1051.severity = none           # RCS1051: Parenthesize condition of conditional expression
dotnet_diagnostic.RCS1063.severity = suggestion     # RCS1063: Avoid usage of do statement to create an infinite loop
dotnet_diagnostic.RCS1064.severity = suggestion     # RCS1064: Avoid usage of for statement to create an infinite loop
dotnet_diagnostic.RCS1065.severity = none           # RCS1065: Avoid usage of while statement to create an infinite loop
dotnet_diagnostic.RCS1069.severity = none           # RCS1069: Remove unnecessary case label
dotnet_diagnostic.RCS1111.severity = none           # RCS1111: Add braces to switch section with multiple statements
dotnet_diagnostic.RCS1124.severity = none           # RCS1124: Inline local variable
dotnet_diagnostic.RCS1126.severity = suggestion     # RCS1126: Add braces to if-else
dotnet_diagnostic.RCS1196.severity = suggestion     # RCS1196: Call extension method as instance method
dotnet_diagnostic.RCS1208.severity = none           # RCS1208: Reduce 'if' nesting
dotnet_diagnostic.RCS1248.severity = suggestion     # RCS1248: Use pattern matching to check for null (or vice versa)
dotnet_diagnostic.RCS1221.severity = none           # RCS1221: Use pattern matching instead of combination of 'as' operator and null check

##########################################
# Rules for Roslynator.Formatting.Analyzers
# See https://github.com/JosefPihrt/Roslynator/blob/master/src/Formatting.Analyzers/README.md
# Note: All analyzers in Roslynator.Formatting.Analyzers are disabled by default so settings the
# default severity to warning does not work. I need to explicitly set the severity of these diagnostics.
##########################################
[*.cs]
dotnet_diagnostic.RCS0001.severity = suggestion      # RCS0001: Add empty line after embedded statement
dotnet_diagnostic.RCS0003.severity = suggestion      # RCS0003: Add empty line after using directive list
dotnet_diagnostic.RCS0008.severity = suggestion      # RCS0008: Add empty line between block and statement
dotnet_diagnostic.RCS0010.severity = suggestion      # RCS0010: Add empty line between declarations
dotnet_diagnostic.RCS0021.severity = suggestion      # RCS0021: Add newline after opening brace of block
dotnet_diagnostic.RCS0022.severity = suggestion      # RCS0022: Add newline after opening brace of empty block
dotnet_diagnostic.RCS0023.severity = suggestion      # RCS0023: Add newline after opening brace of type declaration
dotnet_diagnostic.RCS0024.severity = suggestion      # RCS0024: Add newline after switch label
dotnet_diagnostic.RCS0025.severity = suggestion      # RCS0025: Add newline before accessor of full property
dotnet_diagnostic.RCS0027.severity = suggestion      # RCS0027: Add newline before binary operator instead of after it (or vice versa)
dotnet_diagnostic.RCS0028.severity = suggestion      # RCS0028: Add newline before conditional operator instead of after it (or vice versa)
dotnet_diagnostic.RCS0030.severity = suggestion      # RCS0030: Add newline before embedded statement
dotnet_diagnostic.RCS0031.severity = suggestion      # RCS0031: Add newline before enum member
dotnet_diagnostic.RCS0033.severity = suggestion      # RCS0033: Add newline before statement
dotnet_diagnostic.RCS0034.severity = suggestion      # RCS0034: Add newline before type parameter constraint
dotnet_diagnostic.RCS0039.severity = suggestion      # RCS0039: Remove newline before base list
dotnet_diagnostic.RCS0041.severity = suggestion      # RCS0041: Remove newline between 'if' keyword and 'else' keyword
dotnet_diagnostic.RCS0042.severity = suggestion      # RCS0042: Remove newlines from accessor list of auto-property
dotnet_diagnostic.RCS0043.severity = none            # RCS0043: Format accessor's braces on a single line when expression is on single line
dotnet_diagnostic.RCS0050.severity = suggestion      # RCS0050: Add empty line before top declaration
dotnet_diagnostic.RCS0051.severity = suggestion      # RCS0051: Add newline between closing brace and 'while' keyword (or vice versa)
dotnet_diagnostic.RCS0054.severity = suggestion      # RCS0054: Fix formatting of a call chain
dotnet_diagnostic.RCS0055.severity = suggestion      # RCS0055: Fix formatting of a binary expression chain

##########################################
# Rules for StyleCop.Analyzers
# See https://dotnetanalyzers.github.io/StyleCopAnalyzers/ and https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/DOCUMENTATION.md
##########################################
[*.cs]
# Special Rules (SA0000-)
dotnet_diagnostic.SA0001.severity = none        # SA0001: XML comment analysis is disabled due to project configuration.
# Spacing Rules (SA1000-)
dotnet_diagnostic.SA1000.severity = suggestion  # SA1000: Keywords should be spaced correctly
dotnet_diagnostic.SA1001.severity = suggestion  # SA1001: Commas should be spaced correctly
dotnet_diagnostic.SA1002.severity = suggestion  # SA1002: Semicolons should be spaced correctly
dotnet_diagnostic.SA1003.severity = suggestion  # SA1003: Symbols should be spaced correctly
dotnet_diagnostic.SA1004.severity = suggestion  # SA1004: Documentation lines should begin with single space
dotnet_diagnostic.SA1005.severity = suggestion  # SA1005: Single line comments should begin with single space
dotnet_diagnostic.SA1006.severity = suggestion  # SA1006: Preprocessor keywords should not be preceded by space
dotnet_diagnostic.SA1007.severity = suggestion  # SA1007: Operator keyword should be followed by space
dotnet_diagnostic.SA1008.severity = suggestion  # SA1008: Opening parenthesis should be spaced correctly
dotnet_diagnostic.SA1009.severity = suggestion  # SA1009: Closing parenthesis should be spaced correctly
dotnet_diagnostic.SA1010.severity = suggestion  # SA1010: Opening square brackets should be spaced correctly
dotnet_diagnostic.SA1011.severity = suggestion  # SA1011: Closing square brackets should be spaced correctly
dotnet_diagnostic.SA1012.severity = suggestion  # SA1012: Opening braces should be spaced correctly
dotnet_diagnostic.SA1013.severity = suggestion  # SA1013: Closing braces should be spaced correctly
dotnet_diagnostic.SA1014.severity = suggestion  # SA1014: Opening generic brackets should be spaced correctly
dotnet_diagnostic.SA1015.severity = suggestion  # SA1015: Closing generic brackets should be spaced correctly
dotnet_diagnostic.SA1016.severity = suggestion  # SA1016: Opening attribute brackets should be spaced correctly
dotnet_diagnostic.SA1017.severity = suggestion  # SA1017: Closing attribute brackets should be spaced correctly
dotnet_diagnostic.SA1018.severity = suggestion  # SA1018: Nullable type symbols should be spaced correctly
dotnet_diagnostic.SA1019.severity = suggestion  # SA1019: Member access symbols should be spaced correctly
dotnet_diagnostic.SA1020.severity = suggestion  # SA1020: Increment decrement symbols should be spaced correctly
dotnet_diagnostic.SA1021.severity = suggestion  # SA1021: Negative signs should be spaced correctly
dotnet_diagnostic.SA1022.severity = suggestion  # SA1022: Positive signs should be spaced correctly
dotnet_diagnostic.SA1023.severity = suggestion  # SA1023: Dereference and access of symbols should be spaced correctly
dotnet_diagnostic.SA1024.severity = suggestion  # SA1024: Colons Should Be Spaced Correctly
dotnet_diagnostic.SA1025.severity = suggestion  # SA1025: Code should not contain multiple whitespace in a row
dotnet_diagnostic.SA1026.severity = suggestion  # SA1026: Code should not contain space after new or stackalloc keyword in implicitly typed array allocation
dotnet_diagnostic.SA1027.severity = suggestion  # SA1027: Use tabs correctly
dotnet_diagnostic.SA1028.severity = suggestion  # SA1028: Code should not contain trailing whitespace
# Readability Rules (SA1100-)
dotnet_diagnostic.SA1101.severity = none        # SA1101: Prefix local calls with this
dotnet_diagnostic.SA1108.severity = none        # SA1108: Block statements should not contain embedded comments
dotnet_diagnostic.SA1116.severity = none        # SA1116: The parameters should begin on the line after the declaration, whenever the parameter span across multiple lines
# Ordering Rules (SA1200-)
dotnet_diagnostic.SA1200.severity = none        # SA1200: Using directive should appear within a namespace declaration
dotnet_diagnostic.SA1201.severity = none        # SA1201: A property should not follow a method
dotnet_diagnostic.SA1202.severity = none        # SA1202: 'public' members should come before 'private' members
dotnet_diagnostic.SA1204.severity = none        # SA1204: Static members should appear before non-static members
dotnet_diagnostic.SA1214.severity = none        # SA1214: Readonly fields should appear before non-readonly fields
# Naming Rules (SA1300-)
dotnet_diagnostic.SA1309.severity = none        # SA1309: Field should not begin with an underscore
dotnet_diagnostic.SA1312.severity = none        # SA1312: The name of a variable in C# does not begin with a lower-case letter. Covered by IDE1006 and this one triggers false warnings when using discard symbol for variables.
dotnet_diagnostic.SA1313.severity = none        # SA1313: Parameter '_' should begin with lower-case letter. Covered by IDE1006 and this one triggers false warnings when using discard symbol for parameters.
# Maintainability Rules (SA1400-)
dotnet_diagnostic.SA1402.severity = none        # SA1402: File may only contain a single type
# Layout Rules (SA1500-)
dotnet_diagnostic.SA1500.severity = suggestion  # SA1500: Braces for multi-line statements should not share line
dotnet_diagnostic.SA1501.severity = suggestion  # SA1501: Statement should not be on a single line
dotnet_diagnostic.SA1502.severity = suggestion  # SA1502: Element should not be on a single line
dotnet_diagnostic.SA1503.severity = suggestion  # SA1503: Braces should not be omitted
dotnet_diagnostic.SA1504.severity = suggestion  # SA1504: All accessors should be single-line or multi-line
dotnet_diagnostic.SA1505.severity = suggestion  # SA1505: Opening braces should not be followed by blank line	true
dotnet_diagnostic.SA1506.severity = suggestion  # SA1506: Element documentation headers should not be followed by blank line
dotnet_diagnostic.SA1507.severity = suggestion  # SA1507: Code should not contain multiple blank lines in a row
dotnet_diagnostic.SA1508.severity = suggestion  # SA1508: Closing braces should not be preceded by blank line	true
dotnet_diagnostic.SA1509.severity = suggestion  # SA1509: Opening braces should not be preceded by blank line	true
dotnet_diagnostic.SA1510.severity = suggestion  # SA1510: Chained statement blocks should not be preceded by blank line
dotnet_diagnostic.SA1511.severity = suggestion  # SA1511: While-do footer should not be preceded by blank line
dotnet_diagnostic.SA1512.severity = none        # SA1512: Single-line comments should not be followed by blank line
dotnet_diagnostic.SA1513.severity = suggestion  # SA1513: Closing brace should be followed by blank line
dotnet_diagnostic.SA1514.severity = suggestion  # SA1514: Element documentation header should be preceded by blank line
dotnet_diagnostic.SA1515.severity = none        # SA1515: Single-line comment should be preceded by blank line
dotnet_diagnostic.SA1516.severity = none        # SA1516: Elements should be separated by blank line
dotnet_diagnostic.SA1517.severity = suggestion  # SA1517: Code should not contain blank lines at start of file
dotnet_diagnostic.SA1518.severity = none        # SA1518: Use line endings correctly at end of file
dotnet_diagnostic.SA1519.severity = suggestion  # SA1519: Braces should not be omitted from multi-line child statement
dotnet_diagnostic.SA1520.severity = suggestion  # SA1520: Use braces consistently	true
# Documentation Rules (SA1600-)
# Regarding SA1600,SA1601 and SA1602:
# I already have warnings to make sure public elements are documented, that is enough. These would force even internal/private elements to be documented.
dotnet_diagnostic.SA1600.severity = none            # SA1600: Elements should be documented
dotnet_diagnostic.SA1601.severity = none            # SA1601: Partial elements should be documented
dotnet_diagnostic.SA1602.severity = none            # SA1602: Enumeration items should be documented
dotnet_diagnostic.SA1604.severity = suggestion      # SA1604: Element documentation should have summary
dotnet_diagnostic.SA1605.severity = suggestion      # SA1605: Partial element documentation should have summary
dotnet_diagnostic.SA1606.severity = suggestion      # SA1606: Element documentation should have summary text
dotnet_diagnostic.SA1607.severity = suggestion      # SA1607: Partial element documentation should have summary text
dotnet_diagnostic.SA1608.severity = suggestion      # SA1608: Element documentation should not have default summary
dotnet_diagnostic.SA1609.severity = none            # SA1609: Property documentation should have value
dotnet_diagnostic.SA1610.severity = suggestion      # SA1610: Property documentation should have value text
dotnet_diagnostic.SA1611.severity = suggestion      # SA1611: Element parameters should be documented
dotnet_diagnostic.SA1612.severity = suggestion      # SA1612: Element parameter documentation should match element parameters
dotnet_diagnostic.SA1613.severity = suggestion      # SA1613: Element parameter documentation should declare parameter name
dotnet_diagnostic.SA1614.severity = suggestion      # SA1614: Element parameter documentation should have text
dotnet_diagnostic.SA1615.severity = suggestion      # SA1615: Element return value should be documented
dotnet_diagnostic.SA1616.severity = suggestion      # SA1616: Element return value documentation should have text
dotnet_diagnostic.SA1617.severity = suggestion      # SA1617: Void return value should not be documented
dotnet_diagnostic.SA1618.severity = suggestion      # SA1618: Generic type parameters should be documented
dotnet_diagnostic.SA1619.severity = suggestion      # SA1619: Generic type parameters should be documented partial class
dotnet_diagnostic.SA1620.severity = suggestion      # SA1620: Generic type parameter documentation should match type parameters #	true	Unknown
dotnet_diagnostic.SA1621.severity = suggestion      # SA1621: Generic type parameter documentation should declare parameter name #	true	Unknown
dotnet_diagnostic.SA1622.severity = suggestion      # SA1622: Generic type parameter documentation should have text #	true	Unknown
dotnet_diagnostic.SA1623.severity = suggestion      # SA1623: Property summary documentation should match accessors
dotnet_diagnostic.SA1624.severity = suggestion      # SA1624: Property summary documentation should omit accessor with restricted access
dotnet_diagnostic.SA1625.severity = suggestion      # SA1625: Element documentation should not be copied and pasted
dotnet_diagnostic.SA1626.severity = suggestion      # SA1626: Single-line comments should not use documentation style slashes
dotnet_diagnostic.SA1627.severity = suggestion      # SA1627: Documentation text should not be empty
dotnet_diagnostic.SA1629.severity = suggestion      # SA1629: Documentation text should end with a period
dotnet_diagnostic.SA1633.severity = none            # SA1633: File should have header
dotnet_diagnostic.SA1634.severity = none            # SA1634: File header should show copyright
dotnet_diagnostic.SA1635.severity = none            # SA1635: File header should have copyright text
dotnet_diagnostic.SA1636.severity = none            # SA1636: File header copyright text should match
dotnet_diagnostic.SA1637.severity = none            # SA1637: File header should contain file name
dotnet_diagnostic.SA1638.severity = none            # SA1638: File header file name documentation should match file name
dotnet_diagnostic.SA1639.severity = none            # SA1639: File header should have summary
dotnet_diagnostic.SA1640.severity = none            # SA1640: File header should have valid company text
dotnet_diagnostic.SA1641.severity = none            # SA1641: File header company name text should match
dotnet_diagnostic.SA1642.severity = suggestion      # SA1642: Constructor summary documentation should begin with standard text
dotnet_diagnostic.SA1643.severity = suggestion      # SA1643: Destructor summary documentation should begin with standard text
dotnet_diagnostic.SA1648.severity = suggestion      # SA1648: inheritdoc should be used with inheriting class
dotnet_diagnostic.SA1649.severity = none            # SA1649: File name should match first type name
dotnet_diagnostic.SA1651.severity = suggestion      # SA1651: Do not use placeholder elements
# Alternative Rules (SX0000-)

##########################################
# Rules for tests
# This block needs to be in the end so the configuration block below
# overrides the above configuration only for tests.
##########################################
[tests/**/*.cs]

##########################################
# Rules for Meziantou.Analyzer
# See https://github.com/meziantou/Meziantou.Analyzer/tree/main/docs
##########################################
[*.cs]
dotnet_diagnostic.MA0032.severity = none    # MA0032 Use an overload with a CancellationToken argument
dotnet_diagnostic.MA0051.severity = none    # MA0051 Method is too long

##########################################
# Rules for Microsoft.VisualStudio.Threading.Analyzers
# See https://github.com/microsoft/vs-threading/blob/main/doc/analyzers/index.md
##########################################
dotnet_diagnostic.VSTHRD200.severity = silent       # VSTHRD200: Use Async suffix for async methods (I don't want to rename my test methods to end with the Async suffix.)

##########################################
# Rules for Roslynator.Analyzers
# See https://github.com/JosefPihrt/Roslynator/blob/master/src/Analyzers/README.md
##########################################
dotnet_diagnostic.RCS1139.severity = none       # RCS1139: Add summary element to documentation comment
dotnet_diagnostic.RCS1140.severity = none       # RCS1140: Add exception to documentation comment
dotnet_diagnostic.RCS1141.severity = none       # RCS1141: Add 'param' element to documentation comment
dotnet_diagnostic.RCS1142.severity = none       # RCS1142: Add 'typeparam' element to documentation comment
dotnet_diagnostic.RCS1226.severity = none       # RCS1226: Add paragraph to documentation comment
dotnet_diagnostic.RCS1228.severity = none       # RCS1228: Unused element in documentation comment
dotnet_diagnostic.RCS1232.severity = none       # RCS1232: Order elements in documentation comment

##########################################
# Rules for StyleCop.Analyzers
# See https://dotnetanalyzers.github.io/StyleCopAnalyzers/ or https://github.com/DotNetAnalyzers/StyleCopAnalyzers/tree/master/documentation
##########################################
dotnet_diagnostic.CS1591.severity = none        # CS1591: Missing XML comment for publicly visible type or member
dotnet_diagnostic.SA1611.severity = none        # SA1611: The documentation for parameter is missing
dotnet_diagnostic.SA1615.severity = none        # SA1615: Element return value should be documented.

##########################################
# Rules for xunit.analyzers
# See https://xunit.net/xunit.analyzers/rules/
##########################################
dotnet_diagnostic.xUnit1004.severity = none     # xUnit1004: Test methods should not be skipped
dotnet_diagnostic.xUnit1044.severity = none     # xUnit1044: Avoid using TheoryData type arguments that are not serializable
dotnet_diagnostic.xUnit1045.severity = none     # xUnit1045: Avoid using TheoryData type arguments that might not be serializable
