root = true

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

[*.cs]
csharp_prefer_braces = true
csharp_style_expression_bodied_accessors = true
csharp_style_expression_bodied_constructors = true
csharp_style_expression_bodied_indexers = true
csharp_style_expression_bodied_lambdas = true
csharp_style_expression_bodied_local_functions = true
csharp_style_expression_bodied_methods = true
csharp_style_expression_bodied_operators = true
csharp_style_expression_bodied_properties = true
csharp_style_namespace_declarations = file_scoped
csharp_style_prefer_switch_expression = true
csharp_style_unused_value_expression_statement_preference = discard_variable
csharp_style_var_elsewhere = true
csharp_style_var_for_built_in_types = true
csharp_style_var_when_type_is_apparent = true
dotnet_diagnostic.IDE0003.severity = warning # Remove this or Me qualification
dotnet_diagnostic.IDE0005.severity = warning # Remove unnecessary using directives
dotnet_diagnostic.IDE0007.severity = warning # Use var instead of explicit type
dotnet_diagnostic.IDE0011.severity = warning # Add braces
dotnet_diagnostic.IDE0021.severity = warning # Use expression body for constructors
dotnet_diagnostic.IDE0022.severity = warning # Use expression body for methods
dotnet_diagnostic.IDE0023.severity = warning # Use expression body for conversion operators
dotnet_diagnostic.IDE0024.severity = warning # Use expression body for operators
dotnet_diagnostic.IDE0025.severity = warning # Use expression body for properties
dotnet_diagnostic.IDE0026.severity = warning # Use expression body for indexers
dotnet_diagnostic.IDE0027.severity = warning # Use expression body for accessors
dotnet_diagnostic.IDE0046.severity = suggestion # Use conditional expression for return
dotnet_diagnostic.IDE0049.severity = warning # Use language keywords instead of framework type names for type references
dotnet_diagnostic.IDE0055.severity = warning # Formatting rule
dotnet_diagnostic.IDE0058.severity = warning # Remove unnecessary expression value
dotnet_diagnostic.IDE0066.severity = warning # Use switch expressions
dotnet_diagnostic.IDE0073.severity = warning # Require file header
dotnet_diagnostic.IDE0130.severity = warning # Namespace does not match folder structure
dotnet_diagnostic.IDE0161.severity = warning # Use file-scoped namespace
dotnet_naming_rule.async_methods_must_end_with_async.severity = warning
dotnet_naming_rule.async_methods_must_end_with_async.style = async_method_style
dotnet_naming_rule.async_methods_must_end_with_async.symbols = async_method_symbols
dotnet_naming_style.async_method_style.capitalization = pascal_case
dotnet_naming_style.async_method_style.required_suffix = Async
dotnet_naming_symbols.async_method_symbols.applicable_kinds = method
dotnet_naming_symbols.async_method_symbols.required_modifiers = async
dotnet_sort_system_directives_first = true
dotnet_style_predefined_type_for_locals_parameters_members = true
dotnet_style_predefined_type_for_member_access = true
dotnet_style_prefer_collection_expression = when_types_exactly_match
dotnet_style_qualification_for_event = false:warning
dotnet_style_qualification_for_field = false:warning
dotnet_style_qualification_for_method = false:warning
dotnet_style_qualification_for_property = false:warning
file_header_template = Copyright (c) Duende Software. All rights reserved.\nSee LICENSE in the project root for license information.
indent_size = 4

[*.razor]
indent_size = 4

# ASP.NET Core middleware Invoke methods cannot be renamed (framework constraint)
[platform/src/Authentication.Web/OpenIdConnect/Hosting/*Middleware.cs]
dotnet_naming_rule.async_methods_must_end_with_async.severity = none

[platform/src/Authentication.Web/Hosting/DynamicProviders/DynamicSchemes/*Middleware.cs]
dotnet_naming_rule.async_methods_must_end_with_async.severity = none

# xUnit test methods use Should_* naming convention without Async suffix
[platform/test/**/*.cs]
dotnet_naming_rule.async_methods_must_end_with_async.severity = none

# Sample test projects also use xUnit test naming conventions
[platform/samples/**/test/**/*.cs]
dotnet_naming_rule.async_methods_must_end_with_async.severity = none

# gRPC service methods override generated base class methods and cannot be renamed (framework constraint)
[platform/src/AdminStudio.Server/Services/**/*GrpcService.cs]
dotnet_naming_rule.async_methods_must_end_with_async.severity = none

[platform/src/AdminStudio.Web/Services/**/*GrpcService.cs]
dotnet_naming_rule.async_methods_must_end_with_async.severity = none

[platform/src/AdminStudio.Web/Services/*GrpcService.cs]
dotnet_naming_rule.async_methods_must_end_with_async.severity = none
