root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4

[*.{json,yml,yaml}]
indent_size = 2

[*.md]
trim_trailing_whitespace = false

# Resource files: values are data, never re-wrap them (IDE formatters used to inject indentation into strings).
[*.resx]
max_line_length = off
ij_xml_keep_line_breaks = true
ij_xml_keep_line_breaks_in_text = true
ij_xml_text_wrap = off
ij_xml_wrap_long_lines = false

[*.{xml,axaml,csproj,props,targets,slnx,manifest,plist}]
indent_size = 4

[*.cs]
# Layout
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_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_space_after_cast = false
csharp_preserve_single_line_statements = true
csharp_preserve_single_line_blocks = true

# Language preferences
csharp_style_namespace_declarations = file_scoped:warning
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion
csharp_style_expression_bodied_methods = when_on_single_line:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_prefer_switch_expression = true:suggestion
csharp_prefer_simple_using_statement = true:suggestion
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false

# Naming: private fields are _camelCase, constants are PascalCase
dotnet_naming_rule.private_fields_underscore.symbols = private_fields
dotnet_naming_rule.private_fields_underscore.style = underscore_camel
dotnet_naming_rule.private_fields_underscore.severity = suggestion
dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private
dotnet_naming_style.underscore_camel.capitalization = camel_case
dotnet_naming_style.underscore_camel.required_prefix = _

# Meziantou.Analyzer rules that do not fit this code base.
dotnet_diagnostic.MA0006.severity = none # string == is already ordinal
dotnet_diagnostic.MA0016.severity = none # concrete collection types in signatures are fine here
dotnet_diagnostic.MA0048.severity = none # small related types share a file
dotnet_diagnostic.MA0049.severity = none # HashTool.App.App
dotnet_diagnostic.MA0051.severity = none # method length

# UI code, tests and benchmarks resume on the caller's context; async void is how UI event handlers are written.
[{src/HashTool.App/**.cs,tests/**.cs,bench/**.cs}]
dotnet_diagnostic.MA0004.severity = none
dotnet_diagnostic.MA0147.severity = none

[{tests/**.cs,bench/**.cs}]
dotnet_diagnostic.MA0002.severity = none
dotnet_diagnostic.MA0009.severity = none
