# Code style for kf3-enhanced. CONTRIBUTING.md explains the conventions; this
# file is what `dotnet format` and the IDE enforce.

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,csproj,props,targets}]
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[*.cs]
# ---- layout -------------------------------------------------------------------
csharp_style_namespace_declarations = file_scoped:warning
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_preserve_single_line_statements = true
csharp_preserve_single_line_blocks = true
csharp_prefer_braces = when_multiline:suggestion
dotnet_sort_system_directives_first = true
csharp_using_directive_placement = outside_namespace:warning

# ---- language -----------------------------------------------------------------
csharp_style_var_for_built_in_types = false:none
csharp_style_var_when_type_is_apparent = true:none
csharp_style_var_elsewhere = true:none
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
dotnet_style_qualification_for_field = false:warning
dotnet_style_qualification_for_method = false:warning
dotnet_style_qualification_for_property = false:warning
dotnet_style_readonly_field = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
dotnet_style_require_accessibility_modifiers = omit_if_default:suggestion

# ---- naming -------------------------------------------------------------------
# Types, methods, properties, events, constants and public fields: PascalCase.
# Private and internal fields: _camelCase. Locals and parameters: camelCase.
dotnet_naming_symbols.types_and_members.applicable_kinds = class, struct, interface, enum, delegate, method, property, event
dotnet_naming_style.pascal.capitalization = pascal_case
dotnet_naming_rule.types_and_members_pascal.symbols = types_and_members
dotnet_naming_rule.types_and_members_pascal.style = pascal
dotnet_naming_rule.types_and_members_pascal.severity = warning

dotnet_naming_symbols.constants.applicable_kinds = field, local
dotnet_naming_symbols.constants.required_modifiers = const
dotnet_naming_rule.constants_pascal.symbols = constants
dotnet_naming_rule.constants_pascal.style = pascal
dotnet_naming_rule.constants_pascal.severity = warning

dotnet_naming_symbols.public_fields.applicable_kinds = field
dotnet_naming_symbols.public_fields.applicable_accessibilities = public
dotnet_naming_rule.public_fields_pascal.symbols = public_fields
dotnet_naming_rule.public_fields_pascal.style = pascal
dotnet_naming_rule.public_fields_pascal.severity = warning

dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private, internal, private_protected
dotnet_naming_style.underscore_camel.capitalization = camel_case
dotnet_naming_style.underscore_camel.required_prefix = _
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 = warning

# Reported by the build (EnforceCodeStyleInBuild), not only in the IDE.
# naming
dotnet_diagnostic.IDE1006.severity = warning
# file-scoped namespace
dotnet_diagnostic.IDE0161.severity = warning
# usings outside the namespace
dotnet_diagnostic.IDE0065.severity = warning
# int, not Int32
dotnet_diagnostic.IDE0049.severity = warning
# no this.
dotnet_diagnostic.IDE0003.severity = warning
# unused using
dotnet_diagnostic.IDE0005.severity = warning
# Hook signatures are fixed by the runtime: (CpuContext c, IMemory m) whether used or not.
dotnet_diagnostic.IDE0044.severity = suggestion
dotnet_diagnostic.IDE0060.severity = none

# Machine-written: the recompiler's output and the vendored runtime keep their own style.
[{generated,tools,auto}/**]
dotnet_analyzer_diagnostic.severity = none
