# Khaemhat code style (SPEC §1.11, §19). Build enforces analyzers and code style (EnforceCodeStyleInBuild). root = true [*] charset = utf-8 end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true indent_style = space indent_size = 4 [*.{csproj,props,targets,xml,json,yml,yaml,razor.css,css,js,html,svg}] indent_size = 2 [*.razor] indent_size = 4 [*.md] trim_trailing_whitespace = false [*.sh] end_of_line = lf [*.cs] # Namespaces and usings csharp_style_namespace_declarations = file_scoped:warning dotnet_sort_system_directives_first = true csharp_using_directive_placement = outside_namespace:warning # var and expression 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_properties = true:suggestion csharp_prefer_braces = when_multiline:suggestion dotnet_style_qualification_for_field = false:warning dotnet_style_qualification_for_property = false:warning dotnet_style_qualification_for_method = false:warning dotnet_style_predefined_type_for_locals_parameters_members = true:warning dotnet_style_readonly_field = true:warning csharp_style_prefer_primary_constructors = true:suggestion # Naming: private fields _camelCase, constants PascalCase dotnet_naming_rule.private_fields.symbols = private_fields dotnet_naming_rule.private_fields.style = underscore_camel dotnet_naming_rule.private_fields.severity = warning dotnet_naming_symbols.private_fields.applicable_kinds = field dotnet_naming_symbols.private_fields.applicable_accessibilities = private dotnet_naming_style.underscore_camel.required_prefix = _ dotnet_naming_style.underscore_camel.capitalization = camel_case dotnet_naming_rule.constants.symbols = constants dotnet_naming_rule.constants.style = pascal dotnet_naming_rule.constants.severity = warning dotnet_naming_symbols.constants.applicable_kinds = field dotnet_naming_symbols.constants.required_modifiers = const dotnet_naming_style.pascal.capitalization = pascal_case # Analyzer adjustments (each with its reason) # CA1515 (make types internal): Khaemhat is an application, but its libraries are consumed across projects. dotnet_diagnostic.CA1515.severity = none # CA1848/CA1873 (LoggerMessage delegates): adopted where logging is hot (Infrastructure/Logging, M2), not everywhere. dotnet_diagnostic.CA1848.severity = suggestion dotnet_diagnostic.CA1873.severity = suggestion # CA2007 (ConfigureAwait): ASP.NET Core has no synchronization context. dotnet_diagnostic.CA2007.severity = none # IDE0005 (unnecessary using) needs GenerateDocumentationFile, which is on: keep it as an error-free warning. dotnet_diagnostic.IDE0005.severity = warning [tests/**.cs] # CA1707 (underscores in names): test names read as Method_Condition_Result. dotnet_diagnostic.CA1707.severity = none # CA1861/CA1847/CA1862: tests pass literal arrays and write the string predicates the query translator must handle. dotnet_diagnostic.CA1861.severity = none dotnet_diagnostic.CA1847.severity = none dotnet_diagnostic.CA1862.severity = none # MSTEST0037 and friends stay at their defaults. # Migration classes are named after their version, M__ (SPEC 5.3). [**/Migrations/*.cs] dotnet_diagnostic.CA1707.severity = none