|
| 1 | +root = true |
| 2 | + |
| 3 | +# All files |
| 4 | +[*] |
| 5 | +indent_style = space |
| 6 | +insert_final_newline = true |
| 7 | +trim_trailing_whitespace = true |
| 8 | +charset = utf-8 |
| 9 | + |
| 10 | +# Code files |
| 11 | +[*.{cs,csx,vb,vbx}] |
| 12 | +indent_size = 4 |
| 13 | + |
| 14 | +# XML project files |
| 15 | +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] |
| 16 | +indent_size = 2 |
| 17 | + |
| 18 | +# XML config files |
| 19 | +[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] |
| 20 | +indent_size = 2 |
| 21 | + |
| 22 | +# JSON files |
| 23 | +[*.json] |
| 24 | +indent_size = 2 |
| 25 | + |
| 26 | +# YAML files |
| 27 | +[*.{yml,yaml}] |
| 28 | +indent_size = 2 |
| 29 | + |
| 30 | +# Shell script files |
| 31 | +[*.sh] |
| 32 | +end_of_line = lf |
| 33 | + |
| 34 | +# PowerShell files |
| 35 | +[*.{ps1,psd1,psm1}] |
| 36 | +indent_size = 4 |
| 37 | + |
| 38 | +# Markdown files |
| 39 | +[*.md] |
| 40 | +trim_trailing_whitespace = false |
| 41 | + |
| 42 | +# Dotnet code style settings: |
| 43 | +[*.{cs,vb}] |
| 44 | + |
| 45 | +# Sort using and Import directives with System.* appearing first |
| 46 | +dotnet_sort_system_directives_first = true |
| 47 | +dotnet_separate_import_directive_groups = false |
| 48 | + |
| 49 | +# Avoid "this." and "Me." if not necessary |
| 50 | +dotnet_style_qualification_for_field = false:suggestion |
| 51 | +dotnet_style_qualification_for_property = false:suggestion |
| 52 | +dotnet_style_qualification_for_method = false:suggestion |
| 53 | +dotnet_style_qualification_for_event = false:suggestion |
| 54 | + |
| 55 | +# Use language keywords instead of framework type names for type references |
| 56 | +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion |
| 57 | +dotnet_style_predefined_type_for_member_access = true:suggestion |
| 58 | + |
| 59 | +# Suggest more modern language features when available |
| 60 | +dotnet_style_object_initializer = true:suggestion |
| 61 | +dotnet_style_collection_initializer = true:suggestion |
| 62 | +dotnet_style_coalesce_expression = true:suggestion |
| 63 | +dotnet_style_null_propagation = true:suggestion |
| 64 | +dotnet_style_explicit_tuple_names = true:suggestion |
| 65 | +dotnet_style_prefer_inferred_tuple_names = true:suggestion |
| 66 | +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion |
| 67 | +dotnet_style_prefer_auto_properties = true:suggestion |
| 68 | +dotnet_style_prefer_conditional_expression_over_assignment = true:silent |
| 69 | +dotnet_style_prefer_conditional_expression_over_return = true:silent |
| 70 | +dotnet_style_prefer_compound_assignment = true:suggestion |
| 71 | +dotnet_style_prefer_simplified_interpolation = true:suggestion |
| 72 | +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion |
| 73 | + |
| 74 | +# Null checking preferences |
| 75 | +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion |
| 76 | + |
| 77 | +# Parentheses preferences |
| 78 | +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent |
| 79 | +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent |
| 80 | +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent |
| 81 | +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent |
| 82 | + |
| 83 | +# Modifier preferences |
| 84 | +dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion |
| 85 | +dotnet_style_readonly_field = true:suggestion |
| 86 | + |
| 87 | +# CSharp code style settings: |
| 88 | +[*.cs] |
| 89 | + |
| 90 | +# Prefer "var" everywhere |
| 91 | +csharp_style_var_for_built_in_types = true:suggestion |
| 92 | +csharp_style_var_when_type_is_apparent = true:suggestion |
| 93 | +csharp_style_var_elsewhere = true:suggestion |
| 94 | + |
| 95 | +# Prefer method-like constructs to have a block body |
| 96 | +csharp_style_expression_bodied_methods = false:none |
| 97 | +csharp_style_expression_bodied_constructors = false:none |
| 98 | +csharp_style_expression_bodied_operators = false:none |
| 99 | + |
| 100 | +# Prefer property-like constructs to have an expression-body |
| 101 | +csharp_style_expression_bodied_properties = true:suggestion |
| 102 | +csharp_style_expression_bodied_indexers = true:suggestion |
| 103 | +csharp_style_expression_bodied_accessors = true:suggestion |
| 104 | +csharp_style_expression_bodied_lambdas = true:suggestion |
| 105 | +csharp_style_expression_bodied_local_functions = false:silent |
| 106 | + |
| 107 | +# Suggest more modern language features when available |
| 108 | +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion |
| 109 | +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion |
| 110 | +csharp_style_inlined_variable_declaration = true:suggestion |
| 111 | +csharp_style_throw_expression = true:suggestion |
| 112 | +csharp_style_conditional_delegate_call = true:suggestion |
| 113 | +csharp_style_prefer_extended_property_pattern = true:suggestion |
| 114 | +csharp_style_prefer_not_pattern = true:suggestion |
| 115 | +csharp_style_prefer_pattern_matching = true:suggestion |
| 116 | +csharp_style_prefer_switch_expression = true:suggestion |
| 117 | +csharp_style_prefer_range_operator = true:suggestion |
| 118 | +csharp_style_prefer_index_operator = true:suggestion |
| 119 | +csharp_style_prefer_null_check_over_type_check = true:suggestion |
| 120 | + |
| 121 | +# Null checking preferences |
| 122 | +csharp_style_prefer_null_check_over_type_check = true:suggestion |
| 123 | + |
| 124 | +# Expression-level preferences |
| 125 | +csharp_prefer_simple_default_expression = true:suggestion |
| 126 | +csharp_style_deconstructed_variable_declaration = true:suggestion |
| 127 | +csharp_style_pattern_local_over_anonymous_function = true:suggestion |
| 128 | +csharp_style_prefer_local_over_anonymous_function = true:suggestion |
| 129 | +csharp_style_prefer_tuple_swap = true:suggestion |
| 130 | +csharp_style_prefer_utf8_string_literals = true:suggestion |
| 131 | +csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion |
| 132 | + |
| 133 | +# Using directive preferences |
| 134 | +csharp_using_directive_placement = outside_namespace:suggestion |
| 135 | + |
| 136 | +# Namespace declaration preferences |
| 137 | +csharp_style_namespace_declarations = file_scoped:suggestion |
| 138 | + |
| 139 | +# Newline settings |
| 140 | +csharp_new_line_before_open_brace = all |
| 141 | +csharp_new_line_before_else = true |
| 142 | +csharp_new_line_before_catch = true |
| 143 | +csharp_new_line_before_finally = true |
| 144 | +csharp_new_line_before_members_in_object_initializers = true |
| 145 | +csharp_new_line_before_members_in_anonymous_types = true |
| 146 | +csharp_new_line_between_query_expression_clauses = true |
| 147 | + |
| 148 | +# Indentation preferences |
| 149 | +csharp_indent_case_contents = true |
| 150 | +csharp_indent_switch_labels = true |
| 151 | +csharp_indent_labels = flush_left |
| 152 | +csharp_indent_block_contents = true |
| 153 | +csharp_indent_braces = false |
| 154 | +csharp_indent_case_contents_when_block = false |
| 155 | + |
| 156 | +# Space preferences |
| 157 | +csharp_space_after_cast = false |
| 158 | +csharp_space_after_keywords_in_control_flow_statements = true |
| 159 | +csharp_space_between_method_call_parameter_list_parentheses = false |
| 160 | +csharp_space_between_method_declaration_parameter_list_parentheses = false |
| 161 | +csharp_space_between_parentheses = false |
| 162 | +csharp_space_before_colon_in_inheritance_clause = true |
| 163 | +csharp_space_after_colon_in_inheritance_clause = true |
| 164 | +csharp_space_around_binary_operators = before_and_after |
| 165 | +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false |
| 166 | +csharp_space_between_method_call_name_and_opening_parenthesis = false |
| 167 | +csharp_space_between_method_call_empty_parameter_list_parentheses = false |
| 168 | +csharp_space_after_comma = true |
| 169 | +csharp_space_after_dot = false |
| 170 | + |
| 171 | +# Wrapping preferences |
| 172 | +csharp_preserve_single_line_statements = false |
| 173 | +csharp_preserve_single_line_blocks = true |
| 174 | + |
| 175 | +# Code block preferences |
| 176 | +csharp_prefer_braces = true:suggestion |
| 177 | +csharp_prefer_simple_using_statement = true:suggestion |
| 178 | + |
| 179 | +# Primary constructors (C# 12) |
| 180 | +csharp_style_prefer_primary_constructors = true:suggestion |
| 181 | + |
| 182 | +# ===================== |
| 183 | +# Naming Conventions |
| 184 | +# ===================== |
| 185 | + |
| 186 | +# Interfaces should begin with 'I' |
| 187 | +dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion |
| 188 | +dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface |
| 189 | +dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i |
| 190 | + |
| 191 | +dotnet_naming_symbols.interface.applicable_kinds = interface |
| 192 | +dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected |
| 193 | +dotnet_naming_symbols.interface.required_modifiers = |
| 194 | + |
| 195 | +dotnet_naming_style.begins_with_i.required_prefix = I |
| 196 | +dotnet_naming_style.begins_with_i.required_suffix = |
| 197 | +dotnet_naming_style.begins_with_i.word_separator = |
| 198 | +dotnet_naming_style.begins_with_i.capitalization = pascal_case |
| 199 | + |
| 200 | +# Types and namespaces should be PascalCase |
| 201 | +dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion |
| 202 | +dotnet_naming_rule.types_should_be_pascal_case.symbols = types |
| 203 | +dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case |
| 204 | + |
| 205 | +dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum, namespace |
| 206 | +dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected |
| 207 | +dotnet_naming_symbols.types.required_modifiers = |
| 208 | + |
| 209 | +dotnet_naming_style.pascal_case.required_prefix = |
| 210 | +dotnet_naming_style.pascal_case.required_suffix = |
| 211 | +dotnet_naming_style.pascal_case.word_separator = |
| 212 | +dotnet_naming_style.pascal_case.capitalization = pascal_case |
| 213 | + |
| 214 | +# Async methods should have "Async" suffix |
| 215 | +dotnet_naming_rule.async_methods_end_in_async.severity = suggestion |
| 216 | +dotnet_naming_rule.async_methods_end_in_async.symbols = any_async_methods |
| 217 | +dotnet_naming_rule.async_methods_end_in_async.style = end_in_async |
| 218 | + |
| 219 | +dotnet_naming_symbols.any_async_methods.applicable_kinds = method |
| 220 | +dotnet_naming_symbols.any_async_methods.applicable_accessibilities = * |
| 221 | +dotnet_naming_symbols.any_async_methods.required_modifiers = async |
| 222 | + |
| 223 | +dotnet_naming_style.end_in_async.required_suffix = Async |
| 224 | +dotnet_naming_style.end_in_async.capitalization = pascal_case |
| 225 | + |
| 226 | +# Private fields should be _camelCase |
| 227 | +dotnet_naming_rule.private_fields_should_be_camel_case.severity = suggestion |
| 228 | +dotnet_naming_rule.private_fields_should_be_camel_case.symbols = private_fields |
| 229 | +dotnet_naming_rule.private_fields_should_be_camel_case.style = camel_case_with_underscore |
| 230 | + |
| 231 | +dotnet_naming_symbols.private_fields.applicable_kinds = field |
| 232 | +dotnet_naming_symbols.private_fields.applicable_accessibilities = private |
| 233 | +dotnet_naming_symbols.private_fields.required_modifiers = |
| 234 | + |
| 235 | +dotnet_naming_style.camel_case_with_underscore.required_prefix = _ |
| 236 | +dotnet_naming_style.camel_case_with_underscore.required_suffix = |
| 237 | +dotnet_naming_style.camel_case_with_underscore.word_separator = |
| 238 | +dotnet_naming_style.camel_case_with_underscore.capitalization = camel_case |
| 239 | + |
| 240 | +# Constants should be PascalCase |
| 241 | +dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion |
| 242 | +dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants |
| 243 | +dotnet_naming_rule.constants_should_be_pascal_case.style = pascal_case |
| 244 | + |
| 245 | +dotnet_naming_symbols.constants.applicable_kinds = field, local |
| 246 | +dotnet_naming_symbols.constants.applicable_accessibilities = * |
| 247 | +dotnet_naming_symbols.constants.required_modifiers = const |
| 248 | + |
| 249 | +# Static readonly fields should be PascalCase |
| 250 | +dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.severity = suggestion |
| 251 | +dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.symbols = static_readonly_fields |
| 252 | +dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.style = pascal_case |
| 253 | + |
| 254 | +dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field |
| 255 | +dotnet_naming_symbols.static_readonly_fields.applicable_accessibilities = * |
| 256 | +dotnet_naming_symbols.static_readonly_fields.required_modifiers = static, readonly |
| 257 | + |
| 258 | +# Local variables should be camelCase |
| 259 | +dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion |
| 260 | +dotnet_naming_rule.locals_should_be_camel_case.symbols = locals |
| 261 | +dotnet_naming_rule.locals_should_be_camel_case.style = camel_case |
| 262 | + |
| 263 | +dotnet_naming_symbols.locals.applicable_kinds = local |
| 264 | +dotnet_naming_symbols.locals.applicable_accessibilities = local |
| 265 | +dotnet_naming_symbols.locals.required_modifiers = |
| 266 | + |
| 267 | +dotnet_naming_style.camel_case.required_prefix = |
| 268 | +dotnet_naming_style.camel_case.required_suffix = |
| 269 | +dotnet_naming_style.camel_case.word_separator = |
| 270 | +dotnet_naming_style.camel_case.capitalization = camel_case |
| 271 | + |
| 272 | +# Parameters should be camelCase |
| 273 | +dotnet_naming_rule.parameters_should_be_camel_case.severity = suggestion |
| 274 | +dotnet_naming_rule.parameters_should_be_camel_case.symbols = parameters |
| 275 | +dotnet_naming_rule.parameters_should_be_camel_case.style = camel_case |
| 276 | + |
| 277 | +dotnet_naming_symbols.parameters.applicable_kinds = parameter |
| 278 | +dotnet_naming_symbols.parameters.applicable_accessibilities = * |
| 279 | +dotnet_naming_symbols.parameters.required_modifiers = |
| 280 | + |
| 281 | +# Type parameters should be prefixed with T |
| 282 | +dotnet_naming_rule.type_parameters_should_be_t_prefixed.severity = suggestion |
| 283 | +dotnet_naming_rule.type_parameters_should_be_t_prefixed.symbols = type_parameters |
| 284 | +dotnet_naming_rule.type_parameters_should_be_t_prefixed.style = t_prefix |
| 285 | + |
| 286 | +dotnet_naming_symbols.type_parameters.applicable_kinds = type_parameter |
| 287 | +dotnet_naming_symbols.type_parameters.applicable_accessibilities = * |
| 288 | +dotnet_naming_symbols.type_parameters.required_modifiers = |
| 289 | + |
| 290 | +dotnet_naming_style.t_prefix.required_prefix = T |
| 291 | +dotnet_naming_style.t_prefix.required_suffix = |
| 292 | +dotnet_naming_style.t_prefix.word_separator = |
| 293 | +dotnet_naming_style.t_prefix.capitalization = pascal_case |
0 commit comments