# https://editorconfig.org
# https://www.jetbrains.com/help/resharper/Using_EditorConfig.html
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/configuration-files
# When opening a file, EditorConfig plugins look for a file named .editorconfig in the directory of the opened file and in every parent directory. A search for .editorconfig files will stop if the root filepath is reached or an EditorConfig file with `root=true` is found.

# Remove the line below if you want to inherit .editorconfig settings from higher directories

##################################################################################
## https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/
## https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/
## Microsoft Rules
root = true

# All files
[*]
indent_style = space

# Xml files
[*.xml]
indent_size = 2

# C# files
[*.cs]

#### Core EditorConfig Options ####

# Indentation and spacing
indent_size = 4
tab_width = 4
max_line_length = 120

# New line preferences
insert_final_newline = false

#### .NET Coding Conventions ####
[*.{cs,vb}]

# Organize usings
dotnet_separate_import_directive_groups = false
dotnet_sort_system_directives_first = true
file_header_template = unset

# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/overview?#enable-on-build
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/language-rules#option-format
# this. and Me. preferences
dotnet_style_qualification_for_event = false:silent
dotnet_style_qualification_for_field = false:silent
dotnet_style_qualification_for_method = false:silent
dotnet_style_qualification_for_property = false:silent

# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_style_predefined_type_for_member_access = true:silent

# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent

# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent

# Expression-level preferences
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_namespace_match_folder = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_object_initializer = true:suggestion
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_prefer_auto_properties = true:suggestion
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion

# Field preferences
dotnet_style_readonly_field = true:warning

# Parameter preferences
dotnet_code_quality_unused_parameters = all:suggestion

# Suppression preferences
dotnet_remove_unnecessary_suppression_exclusions = none

#### C# Coding Conventions ####
[*.cs]

# var preferences
csharp_style_var_elsewhere = false:silent
csharp_style_var_for_built_in_types = false:silent
csharp_style_var_when_type_is_apparent = false:silent

# Expression-bodied members
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_lambdas = true:suggestion
csharp_style_expression_bodied_local_functions = false:silent
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent

# Pattern matching preferences
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_prefer_extended_property_pattern = true:suggestion
csharp_style_prefer_not_pattern = true:suggestion
csharp_style_prefer_pattern_matching = true:silent
csharp_style_prefer_switch_expression = true:suggestion

# Null-checking preferences
csharp_style_conditional_delegate_call = true:suggestion

# Modifier preferences
csharp_prefer_static_anonymous_function = true:suggestion
csharp_prefer_static_local_function = true:warning
csharp_preferred_modifier_order = public,private,protected,internal,file,const,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:suggestion
csharp_style_prefer_readonly_struct = true:suggestion
csharp_style_prefer_readonly_struct_member = true:suggestion

# Code-block preferences
csharp_prefer_braces = true:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_style_namespace_declarations = file_scoped:suggestion
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_primary_constructors = true:suggestion
csharp_style_prefer_top_level_statements = true:silent

# Expression-level preferences
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_local_over_anonymous_function = true:suggestion
csharp_style_prefer_null_check_over_type_check = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_style_prefer_tuple_swap = true:suggestion
csharp_style_prefer_utf8_string_literals = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent

# 'using' directive preferences
csharp_using_directive_placement = outside_namespace:silent

#### C# Formatting Rules ####

# New line preferences
csharp_new_line_before_catch = true
csharp_new_line_before_else = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_open_brace = all
csharp_new_line_between_query_expression_clauses = true

# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_labels = one_less_than_current
csharp_indent_switch_labels = true

# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_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_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false

# Wrapping preferences
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = true

#### Naming styles ####
[*.{cs,vb}]

# Naming rules

dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.severity = suggestion
dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.symbols = types_and_namespaces
dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.style = pascalcase

dotnet_naming_rule.interfaces_should_be_ipascalcase.severity = suggestion
dotnet_naming_rule.interfaces_should_be_ipascalcase.symbols = interfaces
dotnet_naming_rule.interfaces_should_be_ipascalcase.style = ipascalcase

dotnet_naming_rule.type_parameters_should_be_tpascalcase.severity = suggestion
dotnet_naming_rule.type_parameters_should_be_tpascalcase.symbols = type_parameters
dotnet_naming_rule.type_parameters_should_be_tpascalcase.style = tpascalcase

dotnet_naming_rule.methods_should_be_pascalcase.severity = suggestion
dotnet_naming_rule.methods_should_be_pascalcase.symbols = methods
dotnet_naming_rule.methods_should_be_pascalcase.style = pascalcase

dotnet_naming_rule.properties_should_be_pascalcase.severity = suggestion
dotnet_naming_rule.properties_should_be_pascalcase.symbols = properties
dotnet_naming_rule.properties_should_be_pascalcase.style = pascalcase

dotnet_naming_rule.events_should_be_pascalcase.severity = suggestion
dotnet_naming_rule.events_should_be_pascalcase.symbols = events
dotnet_naming_rule.events_should_be_pascalcase.style = pascalcase

dotnet_naming_rule.local_variables_should_be_camelcase.severity = suggestion
dotnet_naming_rule.local_variables_should_be_camelcase.symbols = local_variables
dotnet_naming_rule.local_variables_should_be_camelcase.style = camelcase

dotnet_naming_rule.local_constants_should_be_camelcase.severity = suggestion
dotnet_naming_rule.local_constants_should_be_camelcase.symbols = local_constants
dotnet_naming_rule.local_constants_should_be_camelcase.style = camelcase

dotnet_naming_rule.parameters_should_be_camelcase.severity = suggestion
dotnet_naming_rule.parameters_should_be_camelcase.symbols = parameters
dotnet_naming_rule.parameters_should_be_camelcase.style = camelcase

dotnet_naming_rule.public_fields_should_be_pascalcase.severity = suggestion
dotnet_naming_rule.public_fields_should_be_pascalcase.symbols = public_fields
dotnet_naming_rule.public_fields_should_be_pascalcase.style = pascalcase

dotnet_naming_rule.private_fields_should_be__camelcase.severity = suggestion
dotnet_naming_rule.private_fields_should_be__camelcase.symbols = private_fields
dotnet_naming_rule.private_fields_should_be__camelcase.style = _camelcase

dotnet_naming_rule.private_static_fields_should_be_s_camelcase.severity = suggestion
dotnet_naming_rule.private_static_fields_should_be_s_camelcase.symbols = private_static_fields
dotnet_naming_rule.private_static_fields_should_be_s_camelcase.style = s_camelcase

dotnet_naming_rule.public_constant_fields_should_be_pascalcase.severity = suggestion
dotnet_naming_rule.public_constant_fields_should_be_pascalcase.symbols = public_constant_fields
dotnet_naming_rule.public_constant_fields_should_be_pascalcase.style = pascalcase

dotnet_naming_rule.private_constant_fields_should_be_pascalcase.severity = suggestion
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.symbols = private_constant_fields
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.style = pascalcase

dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.severity = suggestion
dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.symbols = public_static_readonly_fields
dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.style = pascalcase

dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.severity = suggestion
dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.symbols = private_static_readonly_fields
dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.style = pascalcase

dotnet_naming_rule.enums_should_be_pascalcase.severity = suggestion
dotnet_naming_rule.enums_should_be_pascalcase.symbols = enums
dotnet_naming_rule.enums_should_be_pascalcase.style = pascalcase

dotnet_naming_rule.local_functions_should_be_pascalcase.severity = suggestion
dotnet_naming_rule.local_functions_should_be_pascalcase.symbols = local_functions
dotnet_naming_rule.local_functions_should_be_pascalcase.style = pascalcase

dotnet_naming_rule.non_field_members_should_be_pascalcase.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascalcase.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascalcase.style = pascalcase

# Symbol specifications

dotnet_naming_symbols.interfaces.applicable_kinds = interface
dotnet_naming_symbols.interfaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interfaces.required_modifiers =

dotnet_naming_symbols.enums.applicable_kinds = enum
dotnet_naming_symbols.enums.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.enums.required_modifiers =

dotnet_naming_symbols.events.applicable_kinds = event
dotnet_naming_symbols.events.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.events.required_modifiers =

dotnet_naming_symbols.methods.applicable_kinds = method
dotnet_naming_symbols.methods.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.methods.required_modifiers =

dotnet_naming_symbols.properties.applicable_kinds = property
dotnet_naming_symbols.properties.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.properties.required_modifiers =

dotnet_naming_symbols.public_fields.applicable_kinds = field
dotnet_naming_symbols.public_fields.applicable_accessibilities = public, internal
dotnet_naming_symbols.public_fields.required_modifiers =

dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
dotnet_naming_symbols.private_fields.required_modifiers =

dotnet_naming_symbols.private_static_fields.applicable_kinds = field
dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
dotnet_naming_symbols.private_static_fields.required_modifiers = static

dotnet_naming_symbols.types_and_namespaces.applicable_kinds = namespace, class, struct, interface, enum
dotnet_naming_symbols.types_and_namespaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types_and_namespaces.required_modifiers =

dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =

dotnet_naming_symbols.type_parameters.applicable_kinds = namespace
dotnet_naming_symbols.type_parameters.applicable_accessibilities = *
dotnet_naming_symbols.type_parameters.required_modifiers =

dotnet_naming_symbols.private_constant_fields.applicable_kinds = field
dotnet_naming_symbols.private_constant_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
dotnet_naming_symbols.private_constant_fields.required_modifiers = const

dotnet_naming_symbols.local_variables.applicable_kinds = local
dotnet_naming_symbols.local_variables.applicable_accessibilities = local
dotnet_naming_symbols.local_variables.required_modifiers =

dotnet_naming_symbols.local_constants.applicable_kinds = local
dotnet_naming_symbols.local_constants.applicable_accessibilities = local
dotnet_naming_symbols.local_constants.required_modifiers = const

dotnet_naming_symbols.parameters.applicable_kinds = parameter
dotnet_naming_symbols.parameters.applicable_accessibilities = *
dotnet_naming_symbols.parameters.required_modifiers =

dotnet_naming_symbols.public_constant_fields.applicable_kinds = field
dotnet_naming_symbols.public_constant_fields.applicable_accessibilities = public, internal
dotnet_naming_symbols.public_constant_fields.required_modifiers = const

dotnet_naming_symbols.public_static_readonly_fields.applicable_kinds = field
dotnet_naming_symbols.public_static_readonly_fields.applicable_accessibilities = public, internal
dotnet_naming_symbols.public_static_readonly_fields.required_modifiers = readonly, static

dotnet_naming_symbols.private_static_readonly_fields.applicable_kinds = field
dotnet_naming_symbols.private_static_readonly_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = readonly, static

dotnet_naming_symbols.local_functions.applicable_kinds = local_function
dotnet_naming_symbols.local_functions.applicable_accessibilities = *
dotnet_naming_symbols.local_functions.required_modifiers =

# Naming styles

dotnet_naming_style.pascalcase.required_prefix =
dotnet_naming_style.pascalcase.required_suffix =
dotnet_naming_style.pascalcase.word_separator =
dotnet_naming_style.pascalcase.capitalization = pascal_case

dotnet_naming_style.ipascalcase.required_prefix = I
dotnet_naming_style.ipascalcase.required_suffix =
dotnet_naming_style.ipascalcase.word_separator =
dotnet_naming_style.ipascalcase.capitalization = pascal_case

dotnet_naming_style.tpascalcase.required_prefix = T
dotnet_naming_style.tpascalcase.required_suffix =
dotnet_naming_style.tpascalcase.word_separator =
dotnet_naming_style.tpascalcase.capitalization = pascal_case

dotnet_naming_style._camelcase.required_prefix = _
dotnet_naming_style._camelcase.required_suffix =
dotnet_naming_style._camelcase.word_separator =
dotnet_naming_style._camelcase.capitalization = camel_case

dotnet_naming_style.camelcase.required_prefix =
dotnet_naming_style.camelcase.required_suffix =
dotnet_naming_style.camelcase.word_separator =
dotnet_naming_style.camelcase.capitalization = camel_case

dotnet_naming_style.s_camelcase.required_prefix = s_
dotnet_naming_style.s_camelcase.required_suffix =
dotnet_naming_style.s_camelcase.word_separator =
dotnet_naming_style.s_camelcase.capitalization = camel_case

##################################################################################
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/
##################################################################################
## Roslyn Code quality rules

dotnet_diagnostic.CA1030.severity = none
dotnet_diagnostic.CA1034.severity = none
dotnet_diagnostic.CA1062.severity = suggestion
dotnet_code_quality.CA1062.exclude_extension_method_this_parameter = true
dotnet_code_quality.exclude_extension_method_this_parameter = true
dotnet_code_quality.null_check_validation_methods = ThrowIfArgumentIsNull
# CA1031: Do not catch general exception types
dotnet_diagnostic.CA1031.severity = none
# CA1303: Do not pass literals as localized parameters
dotnet_diagnostic.CA1303.severity = none
# CA1304: Specify CultureInfo
dotnet_diagnostic.CA1304.severity = error
# CA1307: Specify StringComparison for clarity
dotnet_diagnostic.CA1307.severity = error
# CA1308: Normalize strings to uppercase
dotnet_diagnostic.CA1308.severity = none
# CA1309: Use ordinal StringComparison
dotnet_diagnostic.CA1309.severity = error
# CA1724: Type names should not match namespaces
dotnet_diagnostic.CA1724.severity = none
# CA1819: Properties should not return arrays
dotnet_diagnostic.CA1819.severity = none
# CA1851: Possible multiple enumerations of IEnumerable collection. Related to GH-issue #2000
dotnet_diagnostic.CA1851.severity = suggestion
# CA1859: Use concrete types when possible for improved performance
dotnet_diagnostic.CA1859.severity = suggestion
# CA1860: Avoid using 'Enumerable.Any()' extension method
dotnet_diagnostic.CA1860.severity = warning
# CA1861: Avoid constant arrays as arguments
dotnet_diagnostic.CA1861.severity = none
# CA2007: Do not directly await a Task
dotnet_diagnostic.CA2007.severity = none
# CA2225: Operator overloads have named alternates
dotnet_diagnostic.CA2225.severity = none
# CA3075: Insecure DTD Processing
dotnet_diagnostic.CA3075.severity = none
# CA5369: Use XmlReader for Deserialize
dotnet_diagnostic.CA5369.severity = none
# CA1305: Specify IFormatProvider
dotnet_diagnostic.CA1305.severity = None
# CA1063: Implement IDisposable correctly
dotnet_diagnostic.CA1063.severity = None
# CA2201: Do not raise reserved exception types
dotnet_diagnostic.ca2201.severity = Suggestion
# CA1848: Use the LoggerMessage delegates
dotnet_diagnostic.ca1848.severity = Suggestion
# CA1810: Initialize reference type static fields inline
dotnet_diagnostic.ca1810.severity = Suggestion
# CA1725: Parameter names should match base declaration
dotnet_diagnostic.ca1725.severity = Suggestion
# CA1515: Consider making public types internal
dotnet_diagnostic.CA1515.severity = None
# CA2000: Dispose objects before losing scope
dotnet_diagnostic.CA2000.severity = Suggestion
# CA1707: Identifiers should not contain underscores
dotnet_diagnostic.CA1707.severity = None
# CA1716: Identifiers should not match keywords
dotnet_diagnostic.CA1716.severity = Suggestion
# CA1032: Implement standard exception constructors
dotnet_diagnostic.CA1032.severity = Suggestion
# AV1500: A method should not exceed a predefined number (60-100 lines) of lines
dotnet_diagnostic.AV1500.severity = none

##################################################################################
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/
##################################################################################
## Roslyn Code-style rules

dotnet_diagnostic.IDE0048.severity = Suggestion
dotnet_diagnostic.IDE0028.severity = Suggestion
dotnet_diagnostic.IDE0029.severity = Suggestion
dotnet_diagnostic.IDE0030	.severity = Suggestion
dotnet_diagnostic.IDE0004.severity = error

# IDE0005: Remove unnecessary usings/imports
dotnet_diagnostic.IDE0005.severity = warning

# IDE0051: Remove unused private members (no reads or writes)
dotnet_diagnostic.IDE0051.severity = Suggestion

# IDE0052: Remove unread private members (writes but no reads)
dotnet_diagnostic.IDE0052.severity = warning

# Remove unnecessary using directives (IDE0005)
dotnet_diagnostic.IDE0005.severity = none

# CS1574: XML comment on 'construct' has syntactically incorrect cref attribute 'name'
dotnet_diagnostic.CS1574.severity = error

# IDE0055: Fix formatting
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/csharp-formatting-options
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/dotnet-formatting-options
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0055

# https://csharpier.com/docs/IntegratingWithLinters#code-analysis-rules
dotnet_diagnostic.IDE0055.severity = none

##################################################################################
# https://jetbrains.com.xy2401.com/help/resharper/EditorConfig_Index.html
# https://jetbrains.com.xy2401.com/help/resharper/Reference__Code_Inspections_CSHARP.html
## Resharper

# ReSharper properties
resharper_align_linq_query = true
resharper_align_multiline_array_and_object_initializer = true
resharper_align_multiline_binary_patterns = true
resharper_align_multiline_expression = true
resharper_align_multiline_extends_list = true
resharper_align_multiline_parameter = true
resharper_align_multiline_property_pattern = true
resharper_align_multiline_switch_expression = true
resharper_align_multiple_declaration = true
resharper_align_multline_type_parameter_constrains = true
resharper_align_multline_type_parameter_list = true
resharper_align_tuple_components = true
resharper_braces_for_for = required_for_multiline
resharper_braces_for_foreach = required_for_multiline
resharper_braces_for_ifelse = required_for_multiline
resharper_csharp_alignment_tab_fill_style = optimal_fill
resharper_csharp_indent_type_constraints = false
resharper_csharp_int_align_fix_in_adjacent = false
resharper_csharp_outdent_commas = true
resharper_csharp_stick_comment = false
resharper_csharp_wrap_after_declaration_lpar = true
resharper_csharp_wrap_after_invocation_lpar = true
resharper_csharp_wrap_arguments_style = chop_if_long
resharper_csharp_wrap_before_declaration_rpar = true
resharper_csharp_wrap_before_first_type_parameter_constraint = true
resharper_csharp_wrap_before_ternary_opsigns = false
resharper_csharp_wrap_extends_list_style = chop_if_long
resharper_csharp_wrap_multiple_declaration_style = wrap_if_long
resharper_csharp_wrap_multiple_type_parameter_constraints_style = chop_always
resharper_csharp_wrap_parameters_style = chop_if_long
resharper_enforce_line_ending_style = true
resharper_indent_anonymous_method_block = true
resharper_indent_braces_inside_statement_conditions = false
resharper_indent_nested_fixed_stmt = true
resharper_indent_nested_foreach_stmt = true
resharper_indent_nested_for_stmt = true
resharper_indent_nested_lock_stmt = true
resharper_indent_nested_usings_stmt = true
resharper_indent_nested_while_stmt = true
resharper_keep_existing_declaration_block_arrangement = true
resharper_keep_existing_declaration_parens_arrangement = false
resharper_keep_existing_embedded_arrangement = false
resharper_keep_existing_embedded_block_arrangement = true
resharper_keep_existing_enum_arrangement = true
resharper_keep_existing_invocation_parens_arrangement = false
resharper_keep_existing_property_patterns_arrangement = false
resharper_keep_existing_switch_expression_arrangement = false
resharper_max_array_initializer_elements_on_line = 700
resharper_max_formal_parameters_on_line = 500
resharper_max_invocation_arguments_on_line = 700
resharper_new_line_before_while = true
resharper_place_attribute_on_same_line = false
resharper_place_linq_into_on_new_line = false
resharper_place_simple_case_statement_on_same_line = if_owner_is_single_line
resharper_place_simple_property_pattern_on_single_line = false
resharper_show_autodetect_configure_formatting_tip = false
resharper_space_within_single_line_array_initializer_braces = false
resharper_trailing_comma_in_multiline_lists = true
resharper_trailing_comma_in_singleline_lists = true
resharper_use_heuristics_for_body_style = false
resharper_use_indent_from_vs = false
resharper_use_roslyn_logic_for_evident_types = true
resharper_wrap_array_initializer_style = chop_always
resharper_wrap_chained_binary_expressions = chop_if_long
resharper_wrap_chained_binary_patterns = chop_if_long
resharper_wrap_chained_method_calls = chop_if_long
resharper_wrap_for_stmt_header_style = wrap_if_long
resharper_wrap_switch_expression = chop_if_long
resharper_wrap_verbatim_interpolated_strings = chop_if_long

# ReSharper inspection severities
resharper_arrange_accessor_owner_body_highlighting = none
resharper_arrange_redundant_parentheses_highlighting = hint
resharper_arrange_type_member_modifiers_highlighting = hint
resharper_arrange_type_modifiers_highlighting = hint
resharper_check_namespace_highlighting = none
resharper_enforce_if_statement_braces_highlighting = hint
resharper_inconsistent_naming_highlighting = suggestion
resharper_static_member_in_generic_type_highlighting = none
resharper_suggest_var_or_type_built_in_types_highlighting = hint
resharper_suggest_var_or_type_elsewhere_highlighting = hint
resharper_suggest_var_or_type_simple_types_highlighting = hint
resharper_web_config_module_not_resolved_highlighting = warning
resharper_web_config_type_not_resolved_highlighting = warning
resharper_web_config_wrong_module_highlighting = warning

# https://www.jetbrains.com/help/rider/ClassNeverInstantiated.Global.html
resharper_class_never_instantiated_global_highlighting = none


# Convert lambda expression to method group
resharper_convert_closure_to_method_group_highlighting = none

# Start each element in a object or collection initializer on a new line
resharper_wrap_object_and_collection_initializer_style = chop_always

# Force an empty line
resharper_blank_lines_after_multiline_statements = 1

# Don't remove existing line breaks
resharper_keep_existing_initializer_arrangement = true
resharper_keep_existing_arrangement = true

# We care about that extra else after an else-if
resharper_redundant_if_else_block_highlighting = none

# Don't remove explicit default cases in switch statements
resharper_redundant_empty_switch_section_highlighting = none

resharper_align_multiline_binary_expressions_chain = false

# Only use new() when the type is obvious
resharper_object_creation_when_type_not_evident = explicitly_typed
resharper_object_creation_when_type_evident = target_typed

# Indent 4 spaces per necessary indention
resharper_continuous_indent_multiplier = 1

# Avoid breaking a generic definition
resharper_wrap_before_extends_colon = true

resharper_blank_lines_before_multiline_statements = 1

resharper_parentheses_non_obvious_operations = arithmetic, multiplicative, equality, relational, additive
resharper_parentheses_redundancy_style = remove_if_not_clarifies_precedence

##################################################################################
## https://github.com/DotNetAnalyzers/StyleCopAnalyzers/tree/master/documentation
## https://documentation.help/StyleCop/StyleCop.html
## StyleCop.Analyzers
##################################################################################

# Using directive should appear within a namespace declaration
dotnet_diagnostic.sa1200.severity = None

# Generic type parameter documentation should have text.
dotnet_diagnostic.sa1622.severity = None

# XML comment analysis is disabled due to project configuration
dotnet_diagnostic.sa0001.severity = None

# The file header is missing or not located at the top of the file
dotnet_diagnostic.sa1633.severity = None

# Use string.Empty for empty strings
dotnet_diagnostic.sa1122.severity = None

# Variable '_' should begin with lower-case letter
dotnet_diagnostic.sa1312.severity = None

# Parameter '_' should begin with lower-case letter
dotnet_diagnostic.sa1313.severity = None

# Elements should be documented
dotnet_diagnostic.sa1600.severity = None

# Prefix local calls with this
dotnet_diagnostic.sa1101.severity = None

# 'public' members should come before 'private' members
dotnet_diagnostic.sa1202.severity = None

# Comments should contain text
dotnet_diagnostic.sa1120.severity = None

# Constant fields should appear before non-constant fields
dotnet_diagnostic.sa1203.severity = None

# Field '_blah' should not begin with an underscore
dotnet_diagnostic.sa1309.severity = None

# Use trailing comma in multi-line initializers
dotnet_diagnostic.sa1413.severity = None

# A method should not follow a class
dotnet_diagnostic.sa1201.severity = None

# Elements should be separated by blank line
dotnet_diagnostic.sa1516.severity = None

# The parameter spans multiple lines
dotnet_diagnostic.sa1118.severity = None

# Static members should appear before non-static members
dotnet_diagnostic.sa1204.severity = None

# Put constructor initializers on their own line
dotnet_diagnostic.sa1128.severity = None

# Opening braces should not be preceded by blank line
dotnet_diagnostic.sa1509.severity = None

# The parameter should begin on the line after the previous parameter
dotnet_diagnostic.sa1115.severity = None

# File name should match first type name
dotnet_diagnostic.sa1649.severity = None

# File may only contain a single type
dotnet_diagnostic.sa1402.severity = None

# Enumeration items should be documented
dotnet_diagnostic.sa1602.severity = None

# Element should not be on a single line
dotnet_diagnostic.sa1502.severity = None

# Closing parenthesis should not be preceded by a space
dotnet_diagnostic.sa1009.severity = None

# Closing parenthesis should be on line of last parameter
dotnet_diagnostic.sa1111.severity = None

# Braces should not be ommitted
dotnet_diagnostic.sa1503.severity = None

dotnet_diagnostic.sa1401.severity = None

# The parameters to a C# method or indexer call or declaration are not all on the same line or each on a separate line.
# dotnet_diagnostic.SA1117.severity = Suggestion

# The parameters to a C# method or indexer call or declaration span across multiple lines, but the first parameter does not start on the line after the opening bracket.
# dotnet_diagnostic.SA1116.severity = Suggestion

# A C# partial element is missing a documentation header.
dotnet_diagnostic.sa1601.severity = None

# A <param> tag within a C# element’s documentation header is empty.
dotnet_diagnostic.sa1614.severity = None

# A C# element is missing documentation for its return value.
dotnet_diagnostic.sa1615.severity = None

# The <returns> tag within a C# element’s documentation header is empty.
dotnet_diagnostic.sa1616.severity = None

# An opening brace within a C# element is not spaced correctly.
dotnet_diagnostic.sa1012.severity = Suggestion

# A closing brace within a C# element is not spaced correctly.
dotnet_diagnostic.sa1013.severity = Suggestion

# A call to an instance member of the local class or a base class is not prefixed with 'this.', within a C# code file.
dotnet_diagnostic.sa1101.severity = None

# The keywords within the declaration of an element do not follow a standard ordering scheme.
dotnet_diagnostic.SA1206.severity = None

dotnet_diagnostic.SA1106.severity = None

# https://csharpier.com/docs/IntegratingWithLinters#stylecopanalyzers
# IDE0055: Fix formatting
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/csharp-formatting-options
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/dotnet-formatting-options
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0055

# StyleCopAnalyzers
dotnet_diagnostic.SA1000.severity = none
dotnet_diagnostic.SA1009.severity = none
dotnet_diagnostic.SA1111.severity = none
dotnet_diagnostic.SA1118.severity = none
dotnet_diagnostic.SA1137.severity = none
dotnet_diagnostic.SA1413.severity = none
dotnet_diagnostic.SA1500.severity = none
dotnet_diagnostic.SA1501.severity = none
dotnet_diagnostic.SA1502.severity = none
dotnet_diagnostic.SA1504.severity = none
dotnet_diagnostic.SA1515.severity = none
dotnet_diagnostic.SA1516.severity = none

# for csharpier <= 0.21.0
dotnet_diagnostic.SA1127.severity = none
dotnet_diagnostic.SA1128.severity = none

dotnet_diagnostic.SA1001.severity = none
dotnet_diagnostic.SA1002.severity = none
dotnet_diagnostic.SA1003.severity = none
dotnet_diagnostic.SA1007.severity = none
dotnet_diagnostic.SA1008.severity = none
dotnet_diagnostic.SA1010.severity = none
dotnet_diagnostic.SA1011.severity = none
dotnet_diagnostic.SA1012.severity = none
dotnet_diagnostic.SA1013.severity = none
dotnet_diagnostic.SA1014.severity = none
dotnet_diagnostic.SA1015.severity = none
dotnet_diagnostic.SA1016.severity = none
dotnet_diagnostic.SA1017.severity = none
dotnet_diagnostic.SA1018.severity = none
dotnet_diagnostic.SA1019.severity = none
dotnet_diagnostic.SA1020.severity = none
dotnet_diagnostic.SA1021.severity = none
dotnet_diagnostic.SA1022.severity = none
dotnet_diagnostic.SA1023.severity = none
dotnet_diagnostic.SA1024.severity = none
dotnet_diagnostic.SA1025.severity = none
dotnet_diagnostic.SA1026.severity = none
dotnet_diagnostic.SA1027.severity = none
dotnet_diagnostic.SA1028.severity = none
dotnet_diagnostic.SA1102.severity = none
dotnet_diagnostic.SA1103.severity = none
dotnet_diagnostic.SA1104.severity = none
dotnet_diagnostic.SA1105.severity = none
dotnet_diagnostic.SA1107.severity = none
dotnet_diagnostic.SA1110.severity = none
dotnet_diagnostic.SA1112.severity = none
dotnet_diagnostic.SA1113.severity = none
dotnet_diagnostic.SA1114.severity = none
dotnet_diagnostic.SA1115.severity = none
dotnet_diagnostic.SA1116.severity = none
dotnet_diagnostic.SA1117.severity = none
dotnet_diagnostic.SA1127.severity = none
dotnet_diagnostic.SA1128.severity = none
dotnet_diagnostic.SA1136.severity = none
dotnet_diagnostic.SA1505.severity = none
dotnet_diagnostic.SA1506.severity = none
dotnet_diagnostic.SA1507.severity = none
dotnet_diagnostic.SA1508.severity = none
dotnet_diagnostic.SA1509.severity = none
dotnet_diagnostic.SA1510.severity = none
dotnet_diagnostic.SA1511.severity = none
dotnet_diagnostic.SA1517.severity = none
dotnet_diagnostic.SA1518.severity = none

##################################################################################
## https://github.com/meziantou/Meziantou.Analyzer/tree/main/docs
## Meziantou.Analyzer

# MA0048: File name must match type name
dotnet_diagnostic.ma0048.severity = Suggestion

# MA0051: Method is too long
dotnet_diagnostic.ma0051.severity = Suggestion

# https://www.meziantou.net/string-comparisons-are-harder-than-it-seems.htm
# MA0006 - Use String.Equals instead of equality operator
dotnet_diagnostic.ma0006.severity = Suggestion

# MA0002 - IEqualityComparer<string> or IComparer<string> is missing
dotnet_diagnostic.ma0002.severity = Suggestion

# MA0001 - StringComparison is missing
dotnet_diagnostic.ma0001.severity = Suggestion

# https://cezarypiatek.github.io/post/async-analyzers-p2/#13-pass-cancellation-token
# MA0040: Specify a cancellation token
dotnet_diagnostic.ma0032.severity = Suggestion

# https://cezarypiatek.github.io/post/async-analyzers-p2/#13-pass-cancellation-token
# MA0040: Flow the cancellation token when available
dotnet_diagnostic.ma0040.severity = Suggestion

# https://cezarypiatek.github.io/post/async-analyzers-p2/#14-using-cancellation-token-with-iasyncenumerable
# MA0079: Use a cancellation token using .WithCancellation()
dotnet_diagnostic.ma0079.severity = Suggestion

# https://cezarypiatek.github.io/post/async-analyzers-p2/#14-using-cancellation-token-with-iasyncenumerable
# MA0080: Use a cancellation token using .WithCancellation()
dotnet_diagnostic.ma0080.severity = Suggestion

# Use Task.ConfigureAwait(false) as the current SynchronizationContext is not needed
dotnet_diagnostic.MA0004.severity = none

# Add regex evaluation timeout
dotnet_diagnostic.MA0009.severity = none

# Use an overload of 'ToString' that has a 'System.IFormatProvider' parameter. Already caught by CA1305.
dotnet_diagnostic.MA0011.severity = none

# Use an overload of 'System.ArgumentException' with the parameter name. Just a suggestion since we have a bunch of justified exceptions.
dotnet_diagnostic.MA0015.severity = suggestion

# Use an explicit StringComparer to compute hash codes
dotnet_diagnostic.MA0021.severity = none

# Declare types in namespaces. Already caught by CA1050
dotnet_diagnostic.MA0047.severity = none

# Use an overload of 'GetHashCode' that has a StringComparison parameter
dotnet_diagnostic.MA0074.severity = none

# MA0049: Type name should not match containing namespace
dotnet_diagnostic.MA0049.severity = none

##################################################################################
## https://github.com/JosefPihrt/Roslynator/blob/main/docs/Configuration.md
## https://josefpihrt.github.io/docs/
## Roslynator
##################################################################################

# RCS1036 -	Remove redundant empty line.
dotnet_diagnostic.rcs1036.severity = None

# RCS1037 - Remove trailing white-space.
dotnet_diagnostic.rcs1037.severity = None

# RCS1194: Implement exception constructors
dotnet_diagnostic.rcs1194.severity = None

# https://cezarypiatek.github.io/post/async-analyzers-p1/#1-redundant-asyncawait
# RCS1174: Remove redundant async/await.
dotnet_diagnostic.rcs1174.severity = error

# https://cezarypiatek.github.io/post/async-analyzers-p2/#10-returning-null-from-a-task-returning-method
# RCS1210: Return Task.FromResult instead of returning null.
dotnet_diagnostic.rcs1210.severity = error

# https://cezarypiatek.github.io/post/async-analyzers-p2/#9-missing-configureawaitbool
# RCS1090: Call 'ConfigureAwait(false)'.
dotnet_diagnostic.rcs1090.severity = Suggestion

# https://cezarypiatek.github.io/post/async-analyzers-p2/#11-asynchronous-method-names-should-end-with-async
#RCS1046: Asynchronous method name should end with 'Async'.
dotnet_diagnostic.rcs1046.severity = Suggestion

# https://cezarypiatek.github.io/post/async-analyzers-p2/#12-non-asynchronous-method-names-shouldnt-end-with-async
# RCS1047: Non-asynchronous method name should not end with 'Async'.
dotnet_diagnostic.rcs1047.severity = error

# https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1174.md
# RCS1174: Remove redundant async/await
dotnet_diagnostic.rcs1174.severity = Suggestion

# Combine 'Enumerable.Where' method chain. It doesn't make it more readable in all cases.
dotnet_diagnostic.RCS1112.severity = suggestion

# Inline local variable.
dotnet_diagnostic.RCS1124.severity = suggestion

# Add exception to documentation comment. Nice suggestion, but we don't want to document exceptions for internal code.
dotnet_diagnostic.RCS1140.severity = suggestion

# Missing documentation
dotnet_diagnostic.RCS1141.severity = suggestion
dotnet_diagnostic.RCS1142.severity = suggestion

# Use conditional access. Suggestion because it doesn't always improve readability
dotnet_diagnostic.RCS1146.severity = suggestion

# Enum should declare explicit values. Disabled because we're not storing them.
dotnet_diagnostic.RCS1161.severity = none

# Static member in generic type should use a type parameter. Disabled because it's not always applicable.
dotnet_diagnostic.RCS1158.severity = none

# Add region name to #endregion.
dotnet_diagnostic.RCS1189.severity = none

# Convert comment to documentation comment. Disabled because it also complains about SMELL/REFACTOR comments
dotnet_diagnostic.RCS1181.severity = none

# Use Regex instance instead of static method. Disabled because it's not always worth it.
dotnet_diagnostic.RCS1186.severity = none

# Use bit shift operator.
dotnet_diagnostic.RCS1237.severity = none

# RCS1228: Unused element in documentation comment. (Equivalent to SA1614)
dotnet_diagnostic.RCS1228.severity = suggestion

# RCS1047: Non-asynchronous method name should not end with 'Async'
#dotnet_diagnostic.RCS1047.severity = suggestion

##################################################################################
## https://github.com/semihokur/asyncfixer
## AsyncFixer01
##################################################################################

# https://cezarypiatek.github.io/post/async-analyzers-p1/#1-redundant-asyncawait
# AsyncFixer01: Unnecessary async/await usage
dotnet_diagnostic.asyncfixer01.severity = Suggestion

# https://cezarypiatek.github.io/post/async-analyzers-p1/#2-calling-synchronous-method-inside-the-async-method
# AsyncFixer02: Long-running or blocking operations inside an async method
dotnet_diagnostic.asyncfixer02.severity = error

# https://cezarypiatek.github.io/post/async-analyzers-p1/#3-async-void-method
# AsyncFixer03: Fire & forget async void methods
dotnet_diagnostic.asyncfixer03.severity = error

# https://cezarypiatek.github.io/post/async-analyzers-p1/#6-not-awaited-task-inside-the-using-block
# AsyncFixer04: Fire & forget async call inside a using block
dotnet_diagnostic.asyncfixer04.severity = error

##################################################################################
## https://github.com/microsoft/vs-threading
## Microsoft.VisualStudio.Threading.Analyzers
##################################################################################

# https://cezarypiatek.github.io/post/async-analyzers-p1/#2-calling-synchronous-method-inside-the-async-method
# VSTHRD103: Call async methods when in an async method
dotnet_diagnostic.vsthrd103.severity = Suggestion

# https://cezarypiatek.github.io/post/async-analyzers-p1/#3-async-void-method
# VSTHRD100: Avoid async void methods
dotnet_diagnostic.vsthrd100.severity = error

# https://cezarypiatek.github.io/post/async-analyzers-p1/#4-unsupported-async-delegates
# VSTHRD101: Avoid unsupported async delegates
dotnet_diagnostic.vsthrd101.severity = error

# https://cezarypiatek.github.io/post/async-analyzers-p1/#5-not-awaited-task-within-using-expression
# VSTHRD107: Await Task within using expression
dotnet_diagnostic.vsthrd107.severity = error

# https://cezarypiatek.github.io/post/async-analyzers-p1/#7-unobserved-result-of-asynchronous-method
# VSTHRD110: Observe result of async calls
dotnet_diagnostic.vsthrd110.severity = Suggestion

# https://cezarypiatek.github.io/post/async-analyzers-p2/#8-synchronous-waits
# VSTHRD002: Avoid problematic synchronous waits
dotnet_diagnostic.vsthrd002.severity = Suggestion

# https://cezarypiatek.github.io/post/async-analyzers-p2/#9-missing-configureawaitbool
# VSTHRD111: Use ConfigureAwait(bool)
dotnet_diagnostic.vsthrd111.severity = Suggestion

# https://cezarypiatek.github.io/post/async-analyzers-p2/#10-returning-null-from-a-task-returning-method
# VSTHRD114: Avoid returning a null Task
dotnet_diagnostic.vsthrd114.severity = error

# https://cezarypiatek.github.io/post/async-analyzers-p2/#11-asynchronous-method-names-should-end-with-async
# VSTHRD200: Use "Async" suffix for async methods
dotnet_diagnostic.vsthrd200.severity = Suggestion

# https://cezarypiatek.github.io/post/async-analyzers-p2/#12-non-asynchronous-method-names-shouldnt-end-with-async
# VSTHRD200: Use "Async" suffix for async methods
dotnet_diagnostic.vsthrd200.severity = Suggestion

# VSTHRD003 Avoid awaiting foreign Tasks
dotnet_diagnostic.VSTHRD003.severity = Suggestion


##################################################################################
## https://github.com/hvanbakel/Asyncify-CSharp
## Asyncify
##################################################################################

# https://cezarypiatek.github.io/post/async-analyzers-p2/#8-synchronous-waits
# AsyncifyInvocation: Use Task Async
dotnet_diagnostic.asyncifyinvocation.severity = error

# https://cezarypiatek.github.io/post/async-analyzers-p2/#8-synchronous-waits
# AsyncifyVariable: Use Task Async
dotnet_diagnostic.asyncifyvariable.severity = error
