|
| 1 | +root = true |
| 2 | + |
| 3 | +# All files |
| 4 | +[*] |
| 5 | +charset = utf-8 |
| 6 | +indent_style = space |
| 7 | +indent_size = 4 |
| 8 | +end_of_line = lf |
| 9 | +insert_final_newline = true |
| 10 | +trim_trailing_whitespace = true |
| 11 | + |
| 12 | +# C# files |
| 13 | +[*.cs] |
| 14 | +# Indentation |
| 15 | +indent_size = 4 |
| 16 | +tab_width = 4 |
| 17 | + |
| 18 | +# New lines |
| 19 | +csharp_new_line_before_open_brace = all |
| 20 | +csharp_new_line_before_else = true |
| 21 | +csharp_new_line_before_catch = true |
| 22 | +csharp_new_line_before_finally = true |
| 23 | +csharp_new_line_before_members_in_object_initializers = true |
| 24 | +csharp_new_line_before_members_in_anonymous_types = true |
| 25 | +csharp_new_line_between_query_expression_clauses = true |
| 26 | + |
| 27 | +# Spaces |
| 28 | +csharp_space_after_cast = false |
| 29 | +csharp_space_after_keywords_in_control_flow_statements = true |
| 30 | +csharp_space_between_parentheses = false |
| 31 | +csharp_space_before_colon_in_inheritance_clause = true |
| 32 | +csharp_space_after_colon_in_inheritance_clause = true |
| 33 | +csharp_space_around_binary_operators = before_and_after |
| 34 | +csharp_space_between_method_declaration_parameter_list_parentheses = false |
| 35 | +csharp_space_between_method_call_parameter_list_parentheses = false |
| 36 | +csharp_space_between_method_call_empty_parameter_list_parentheses = false |
| 37 | + |
| 38 | +# Wrapping |
| 39 | +csharp_preserve_single_line_blocks = true |
| 40 | +csharp_preserve_single_line_statements = true |
| 41 | + |
| 42 | +# Organize usings |
| 43 | +dotnet_sort_system_directives_first = true |
| 44 | +dotnet_separate_import_directive_groups = false |
| 45 | + |
| 46 | +# Naming conventions |
| 47 | +dotnet_naming_style.pascal_case_style.capitalization = pascal_case |
| 48 | +dotnet_naming_style.camel_case_style.capitalization = camel_case |
| 49 | + |
| 50 | +# Classes, structs, enums, delegates: PascalCase |
| 51 | +dotnet_naming_symbols.types.applicable_kinds = class, struct, enum, delegate, interface |
| 52 | +dotnet_naming_rule.types_naming.symbols = types |
| 53 | +dotnet_naming_rule.types_naming.style = pascal_case_style |
| 54 | +dotnet_naming_rule.types_naming.severity = suggestion |
| 55 | + |
| 56 | +# Constants: PascalCase |
| 57 | +dotnet_naming_symbols.constants.applicable_kinds = field |
| 58 | +dotnet_naming_symbols.constants.applicable_accessibilities = * |
| 59 | +dotnet_naming_symbols.constants.required_modifiers = const |
| 60 | +dotnet_naming_rule.constants_naming.symbols = constants |
| 61 | +dotnet_naming_rule.constants_naming.style = pascal_case_style |
| 62 | +dotnet_naming_rule.constants_naming.severity = suggestion |
| 63 | + |
| 64 | +# Static fields: PascalCase |
| 65 | +dotnet_naming_symbols.static_fields.applicable_kinds = field |
| 66 | +dotnet_naming_symbols.static_fields.applicable_accessibilities = * |
| 67 | +dotnet_naming_symbols.static_fields.required_modifiers = static |
| 68 | +dotnet_naming_rule.static_fields_naming.symbols = static_fields |
| 69 | +dotnet_naming_rule.static_fields_naming.style = pascal_case_style |
| 70 | +dotnet_naming_rule.static_fields_naming.severity = suggestion |
| 71 | + |
| 72 | +# Instance fields: camelCase with underscore prefix |
| 73 | +dotnet_naming_style.instance_field_style.capitalization = camel_case |
| 74 | +net_naming_style.instance_field_style.required_prefix = _ |
| 75 | +dotnet_naming_symbols.instance_fields.applicable_kinds = field |
| 76 | +dotnet_naming_symbols.instance_fields.applicable_accessibilities = private |
| 77 | +dotnet_naming_rule.instance_fields_naming.symbols = instance_fields |
| 78 | +dotnet_naming_rule.instance_fields_naming.style = instance_field_style |
| 79 | +dotnet_naming_rule.instance_fields_naming.severity = suggestion |
| 80 | + |
| 81 | +# Parameters, locals: camelCase |
| 82 | +dotnet_naming_symbols.parameters_locals.applicable_kinds = parameter, local |
| 83 | +dotnet_naming_rule.parameters_locals_naming.symbols = parameters_locals |
| 84 | +dotnet_naming_rule.parameters_locals_naming.style = camel_case_style |
| 85 | +dotnet_naming_rule.parameters_locals_naming.severity = suggestion |
| 86 | + |
| 87 | +# Expression-bodied members |
| 88 | +csharp_style_expression_bodied_methods = when_on_single_line:suggestion |
| 89 | +csharp_style_expression_bodied_constructors = when_on_single_line:suggestion |
| 90 | +csharp_style_expression_bodied_operators = when_on_single_line:suggestion |
| 91 | +csharp_style_expression_bodied_properties = when_on_single_line:suggestion |
| 92 | +csharp_style_expression_bodied_indexers = when_on_single_line:suggestion |
| 93 | +csharp_style_expression_bodied_accessors = when_on_single_line:suggestion |
| 94 | +csharp_style_expression_bodied_lambdas = when_on_single_line:suggestion |
| 95 | +csharp_style_expression_bodied_local_functions = when_on_single_line:suggestion |
| 96 | + |
| 97 | +# Pattern matching |
| 98 | +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion |
| 99 | +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion |
| 100 | + |
| 101 | +# Var preferences |
| 102 | +csharp_style_var_for_built_in_types = true:suggestion |
| 103 | +csharp_style_var_when_type_is_apparent = true:suggestion |
| 104 | +csharp_style_var_elsewhere = true:suggestion |
| 105 | + |
| 106 | +# Null checking |
| 107 | +csharp_style_throw_expression = true:suggestion |
| 108 | +csharp_style_conditional_delegate_call = true:suggestion |
| 109 | + |
| 110 | +# Modifier preferences |
| 111 | +dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion |
| 112 | +csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:suggestion |
| 113 | + |
| 114 | +# Parentheses preferences |
| 115 | +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion |
| 116 | +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion |
| 117 | +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion |
| 118 | +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion |
| 119 | + |
| 120 | +# Roslyn analyzer settings |
| 121 | +dotnet_diagnostic.CA1822.severity = suggestion # Mark members as static |
| 122 | +dotnet_diagnostic.CA2201.severity = none # Do not raise reserved exception types |
| 123 | +dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary |
| 124 | + |
| 125 | +# XML documentation |
| 126 | +dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion |
| 127 | + |
| 128 | +# Project files |
| 129 | +[*.{csproj,props,targets}] |
| 130 | +indent_size = 2 |
| 131 | + |
| 132 | +# JSON files |
| 133 | +[*.{json,jsonc}] |
| 134 | +indent_size = 2 |
| 135 | + |
| 136 | +# YAML files |
| 137 | +[*.{yml,yaml}] |
| 138 | +indent_size = 2 |
| 139 | + |
| 140 | +# Markdown files |
| 141 | +[*.md] |
| 142 | +trim_trailing_whitespace = false |
0 commit comments