root = true

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

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

[*.{csproj,sln,props,targets}]
indent_size = 2

[*.cs]
# .NET code style
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false
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_style_predefined_type_for_member_access = true:suggestion
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
dotnet_style_readonly_field = true:suggestion
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_prefer_auto_properties = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion

# C# code style
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:suggestion
csharp_style_expression_bodied_constructors = false:suggestion
csharp_style_expression_bodied_operators = when_on_single_line:suggestion
csharp_style_expression_bodied_properties = true:suggestion
csharp_style_expression_bodied_indexers = true:suggestion
csharp_style_expression_bodied_accessors = true:suggestion
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_braces = true:suggestion
csharp_style_namespace_declarations = file_scoped:suggestion

# Naming conventions
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.camel_case.capitalization = camel_case
dotnet_naming_style.interface_prefix.capitalization = pascal_case
dotnet_naming_style.interface_prefix.required_prefix = I
dotnet_naming_style.underscore_camel_case.capitalization = camel_case
dotnet_naming_style.underscore_camel_case.required_prefix = _

dotnet_naming_symbols.public_members.applicable_kinds = property,method,field,event
dotnet_naming_symbols.public_members.applicable_accessibilities = public,internal,protected,protected_internal
dotnet_naming_rule.public_members_pascal_case.symbols = public_members
dotnet_naming_rule.public_members_pascal_case.style = pascal_case
dotnet_naming_rule.public_members_pascal_case.severity = suggestion

dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private
dotnet_naming_rule.private_fields_underscore_camel_case.symbols = private_fields
dotnet_naming_rule.private_fields_underscore_camel_case.style = underscore_camel_case
dotnet_naming_rule.private_fields_underscore_camel_case.severity = suggestion

dotnet_naming_symbols.interfaces.applicable_kinds = interface
dotnet_naming_rule.interfaces_prefixed.symbols = interfaces
dotnet_naming_rule.interfaces_prefixed.style = interface_prefix
dotnet_naming_rule.interfaces_prefixed.severity = suggestion

# Formatting
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_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_method_call_parameter_list_parentheses = false

# StyleCop.Analyzers (Directory.Build.props) — only used for its member-ordering
# rules; every other category is noise on top of the built-in .NET style rules above.
dotnet_analyzer_diagnostic.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.OrderingRules.severity = warning

# constant fields, then static fields, then instance fields; readonly before mutable
# within each; constructors; properties/indexers/events; methods — nested types last.
dotnet_diagnostic.SA1201.severity = warning
dotnet_diagnostic.SA1202.severity = warning
dotnet_diagnostic.SA1203.severity = warning
dotnet_diagnostic.SA1204.severity = warning
dotnet_diagnostic.SA1214.severity = warning
dotnet_diagnostic.SA1215.severity = none
# conflicts with file-scoped namespaces (csharp_style_namespace_declarations above)
dotnet_diagnostic.SA1200.severity = none
# fires unconditionally regardless of the blanket severity=none default above; this
# repo doesn't mandate XML doc comments, so it's permanent noise, not a defect.
dotnet_diagnostic.SA0001.severity = none

[*.{tscn,tres,gd,godot}]
insert_final_newline = false
