|
| 1 | +############################### |
| 2 | +# Core EditorConfig Options # |
| 3 | +############################### |
| 4 | + |
| 5 | +# dotnet-format requires version 3.1.37601 |
| 6 | +# dotnet tool update -g dotnet-format |
| 7 | +# remember to have: git config --global core.autocrlf false #(which is usually default) |
| 8 | + |
| 9 | +# top-most EditorConfig file |
| 10 | +root = true |
| 11 | + |
| 12 | +# Don't use tabs for indentation. |
| 13 | +[*] |
| 14 | +indent_style = space |
| 15 | +insert_final_newline = true |
| 16 | +trim_trailing_whitespace = true |
| 17 | +charset = utf-8 |
| 18 | +end_of_line = lf |
| 19 | + |
| 20 | +# (Please don't specify an indent_size here; that has too many unintended consequences.) |
| 21 | +spelling_exclusion_path = SpellingExclusions.dic |
| 22 | + |
| 23 | +# Code files |
| 24 | +[*.{cs,csx,vb,vbx}] |
| 25 | +indent_size = 4 |
| 26 | +insert_final_newline = true |
| 27 | +trim_trailing_whitespace = true |
| 28 | +charset = utf-8 |
| 29 | + |
| 30 | +# XML project files |
| 31 | +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] |
| 32 | +indent_size = 2 |
| 33 | + |
| 34 | +# XML config files |
| 35 | +[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] |
| 36 | +indent_size = 2 |
| 37 | + |
| 38 | +# JSON files |
| 39 | +[*.json] |
| 40 | +indent_size = 2 |
| 41 | + |
| 42 | +# Powershell files |
| 43 | +[*.ps1] |
| 44 | +indent_size = 2 |
| 45 | + |
| 46 | +# Shell script files |
| 47 | +[*.sh] |
| 48 | +end_of_line = lf |
| 49 | +indent_size = 2 |
| 50 | + |
| 51 | +# YAML files |
| 52 | +[*.yml] |
| 53 | +end_of_line = lf |
| 54 | +indent_size = 2 |
| 55 | + |
| 56 | +# Dotnet code style settings: |
| 57 | +[*.{cs,vb}] |
| 58 | +# Use block-scoped namespace |
| 59 | +csharp_style_namespace_declarations = block_scoped:error |
| 60 | +dotnet_diagnostic.IDE0160.severity = error |
| 61 | +dotnet_diagnostic.IDE0161.severity = error |
| 62 | + |
| 63 | +# Member can be made 'readonly' |
| 64 | +csharp_style_prefer_readonly_struct_member = true |
| 65 | +dotnet_diagnostic.IDE0251.severity = warning |
| 66 | +dotnet_diagnostic.IDE0044.severity = warning |
| 67 | + |
| 68 | +dotnet_diagnostic.CS1591.severity = silent |
| 69 | + |
| 70 | +# Sort using and Import directives with System.* appearing first |
| 71 | +dotnet_sort_system_directives_first = false |
| 72 | +dotnet_separate_import_directive_groups = false |
| 73 | + |
| 74 | +# Avoid "this." and "Me." if not necessary |
| 75 | +dotnet_style_qualification_for_field = false:warning |
| 76 | +dotnet_style_qualification_for_property = false:warning |
| 77 | +dotnet_style_qualification_for_method = false:warning |
| 78 | +dotnet_style_qualification_for_event = false:warning |
| 79 | + |
| 80 | +# Use language keywords instead of framework type names for type references |
| 81 | +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion |
| 82 | +dotnet_style_predefined_type_for_member_access = true:suggestion |
| 83 | + |
| 84 | +# Suggest more modern language features when available |
| 85 | +dotnet_style_object_initializer = true:warning |
| 86 | +dotnet_style_collection_initializer = true:warning |
| 87 | +dotnet_style_coalesce_expression = true:suggestion |
| 88 | +dotnet_style_null_propagation = true:suggestion |
| 89 | +dotnet_style_explicit_tuple_names = true:suggestion |
| 90 | + |
| 91 | +# Whitespace options |
| 92 | +dotnet_style_allow_multiple_blank_lines_experimental = false |
| 93 | + |
| 94 | +# Non-private static fields are PascalCase |
| 95 | +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion |
| 96 | +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields |
| 97 | +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style |
| 98 | + |
| 99 | +dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field |
| 100 | +dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected |
| 101 | +dotnet_naming_symbols.non_private_static_fields.required_modifiers = static |
| 102 | + |
| 103 | +dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case |
| 104 | + |
| 105 | +# Non-private readonly fields are PascalCase |
| 106 | +dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion |
| 107 | +dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields |
| 108 | +dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_field_style |
| 109 | + |
| 110 | +dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field |
| 111 | +dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected |
| 112 | +dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly |
| 113 | + |
| 114 | +dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case |
| 115 | + |
| 116 | +# Constants are PascalCase |
| 117 | +dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion |
| 118 | +dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants |
| 119 | +dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style |
| 120 | + |
| 121 | +dotnet_naming_symbols.constants.applicable_kinds = field, local |
| 122 | +dotnet_naming_symbols.constants.required_modifiers = const |
| 123 | + |
| 124 | +dotnet_naming_style.constant_style.capitalization = pascal_case |
| 125 | + |
| 126 | +# Static fields are camelCase and start with s_ |
| 127 | +dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion |
| 128 | +dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields |
| 129 | +dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style |
| 130 | + |
| 131 | +dotnet_naming_symbols.static_fields.applicable_kinds = field |
| 132 | +dotnet_naming_symbols.static_fields.required_modifiers = static |
| 133 | + |
| 134 | +dotnet_naming_style.static_field_style.capitalization = camel_case |
| 135 | +dotnet_naming_style.static_field_style.required_prefix = s_ |
| 136 | + |
| 137 | +# Instance fields are camelCase and start with _ |
| 138 | +dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion |
| 139 | +dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields |
| 140 | +dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style |
| 141 | + |
| 142 | +dotnet_naming_symbols.instance_fields.applicable_kinds = field |
| 143 | + |
| 144 | +dotnet_naming_style.instance_field_style.capitalization = camel_case |
| 145 | +dotnet_naming_style.instance_field_style.required_prefix = _ |
| 146 | + |
| 147 | +# Locals and parameters are camelCase |
| 148 | +dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion |
| 149 | +dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters |
| 150 | +dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style |
| 151 | + |
| 152 | +dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local |
| 153 | + |
| 154 | +dotnet_naming_style.camel_case_style.capitalization = camel_case |
| 155 | + |
| 156 | +# Local functions are PascalCase |
| 157 | +dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion |
| 158 | +dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions |
| 159 | +dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style |
| 160 | + |
| 161 | +dotnet_naming_symbols.local_functions.applicable_kinds = local_function |
| 162 | + |
| 163 | +dotnet_naming_style.local_function_style.capitalization = pascal_case |
| 164 | + |
| 165 | +# By default, name items with PascalCase |
| 166 | +dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion |
| 167 | +dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members |
| 168 | +dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style |
| 169 | + |
| 170 | +dotnet_naming_symbols.all_members.applicable_kinds = * |
| 171 | + |
| 172 | +dotnet_naming_style.pascal_case_style.capitalization = pascal_case |
| 173 | + |
| 174 | +file_header_template = Copyright (C) 2015-2025 The Neo Project.\n\n{fileName} file belongs to the neo project and is free\nsoftware distributed under the MIT software license, see the\naccompanying file LICENSE in the main directory of the\nrepository or http://www.opensource.org/licenses/mit-license.php\nfor more details.\n\nRedistribution and use in source and binary forms with or without\nmodifications are permitted. |
| 175 | + |
| 176 | +# Require file header |
| 177 | +dotnet_diagnostic.IDE0073.severity = error |
| 178 | + |
| 179 | +# RS0016: Only enable if API files are present |
| 180 | +dotnet_public_api_analyzer.require_api_files = true |
| 181 | + |
| 182 | +# IDE0055: Fix formatting |
| 183 | +# Workaround for https://github.com/dotnet/roslyn/issues/70570 |
| 184 | +dotnet_diagnostic.IDE0055.severity = warning |
| 185 | + |
| 186 | +# CSharp code style settings: |
| 187 | +[*.cs] |
| 188 | +# Newline settings |
| 189 | +csharp_new_line_before_open_brace = all |
| 190 | +csharp_new_line_before_else = true |
| 191 | +csharp_new_line_before_catch = true |
| 192 | +csharp_new_line_before_finally = true |
| 193 | +csharp_new_line_before_members_in_object_initializers = true |
| 194 | +csharp_new_line_before_members_in_anonymous_types = true |
| 195 | +csharp_new_line_between_query_expression_clauses = true |
| 196 | + |
| 197 | +# Indentation preferences |
| 198 | +csharp_indent_block_contents = true |
| 199 | +csharp_indent_braces = false |
| 200 | +csharp_indent_case_contents = true |
| 201 | +csharp_indent_case_contents_when_block = true |
| 202 | +csharp_indent_switch_labels = true |
| 203 | +csharp_indent_labels = flush_left |
| 204 | + |
| 205 | +# Whitespace options |
| 206 | +csharp_style_allow_embedded_statements_on_same_line_experimental = false |
| 207 | +csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false |
| 208 | +csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false |
| 209 | +csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false |
| 210 | +csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = false |
| 211 | + |
| 212 | +# Prefer "var" everywhere |
| 213 | +csharp_style_var_for_built_in_types = true:suggestion |
| 214 | +csharp_style_var_when_type_is_apparent = true:suggestion |
| 215 | +csharp_style_var_elsewhere = true:suggestion |
| 216 | + |
| 217 | +# Prefer method-like constructs to have a block body |
| 218 | +csharp_style_expression_bodied_methods = false:none |
| 219 | +csharp_style_expression_bodied_constructors = false:none |
| 220 | +csharp_style_expression_bodied_operators = false:none |
| 221 | + |
| 222 | +# Prefer property-like constructs to have an expression-body |
| 223 | +csharp_style_expression_bodied_properties = true:none |
| 224 | +csharp_style_expression_bodied_indexers = true:none |
| 225 | +csharp_style_expression_bodied_accessors = true:none |
| 226 | + |
| 227 | +# Suggest more modern language features when available |
| 228 | +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion |
| 229 | +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion |
| 230 | +csharp_style_inlined_variable_declaration = true:suggestion |
| 231 | +csharp_style_throw_expression = true:suggestion |
| 232 | +csharp_style_conditional_delegate_call = true:suggestion |
| 233 | +csharp_style_prefer_extended_property_pattern = true:suggestion |
| 234 | + |
| 235 | +# Space preferences |
| 236 | +csharp_space_after_cast = false |
| 237 | +csharp_space_after_colon_in_inheritance_clause = true |
| 238 | +csharp_space_after_comma = true |
| 239 | +csharp_space_after_dot = false |
| 240 | +csharp_space_after_keywords_in_control_flow_statements = true |
| 241 | +csharp_space_after_semicolon_in_for_statement = true |
| 242 | +csharp_space_around_binary_operators = before_and_after |
| 243 | +csharp_space_around_declaration_statements = do_not_ignore |
| 244 | +csharp_space_before_colon_in_inheritance_clause = true |
| 245 | +csharp_space_before_comma = false |
| 246 | +csharp_space_before_dot = false |
| 247 | +csharp_space_before_open_square_brackets = false |
| 248 | +csharp_space_before_semicolon_in_for_statement = false |
| 249 | +csharp_space_between_empty_square_brackets = false |
| 250 | +csharp_space_between_method_call_empty_parameter_list_parentheses = false |
| 251 | +csharp_space_between_method_call_name_and_opening_parenthesis = false |
| 252 | +csharp_space_between_method_call_parameter_list_parentheses = false |
| 253 | +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false |
| 254 | +csharp_space_between_method_declaration_name_and_open_parenthesis = false |
| 255 | +csharp_space_between_method_declaration_parameter_list_parentheses = false |
| 256 | +csharp_space_between_parentheses = false |
| 257 | +csharp_space_between_square_brackets = false |
| 258 | + |
| 259 | +# Blocks are allowed |
| 260 | +csharp_prefer_braces = true:silent |
| 261 | +csharp_preserve_single_line_blocks = true |
| 262 | +csharp_preserve_single_line_statements = true |
| 263 | + |
| 264 | +# IDE0060: Remove unused parameter |
| 265 | +dotnet_diagnostic.IDE0060.severity = none |
| 266 | + |
| 267 | +[src/{Analyzers,CodeStyle,Features,Workspaces,EditorFeatures,VisualStudio}/**/*.{cs,vb}] |
| 268 | + |
| 269 | +# Use collection expression for array |
| 270 | +dotnet_diagnostic.IDE0300.severity = warning |
| 271 | + |
| 272 | +# Avoid "this." and "Me." if not necessary |
| 273 | +dotnet_diagnostic.IDE0003.severity = warning |
| 274 | +dotnet_diagnostic.IDE0009.severity = warning |
| 275 | + |
| 276 | +# IDE0011: Add braces |
| 277 | +csharp_prefer_braces = when_multiline:warning |
| 278 | +# NOTE: We need the below severity entry for Add Braces due to https://github.com/dotnet/roslyn/issues/44201 |
| 279 | +dotnet_diagnostic.IDE0011.severity = warning |
| 280 | + |
| 281 | +# IDE0040: Add accessibility modifiers |
| 282 | +dotnet_diagnostic.IDE0040.severity = warning |
| 283 | + |
| 284 | +# IDE0052: Remove unread private member |
| 285 | +dotnet_diagnostic.IDE0052.severity = warning |
| 286 | + |
| 287 | +# IDE0059: Unnecessary assignment to a value |
| 288 | +dotnet_diagnostic.IDE0059.severity = warning |
| 289 | + |
| 290 | +# CA1012: Abstract types should not have public constructors |
| 291 | +dotnet_diagnostic.CA1012.severity = warning |
| 292 | + |
| 293 | +# CA1822: Make member static |
| 294 | +dotnet_diagnostic.CA1822.severity = warning |
| 295 | + |
| 296 | +# Prefer "var" everywhere |
| 297 | +dotnet_diagnostic.IDE0007.severity = warning |
| 298 | +csharp_style_var_for_built_in_types = true:warning |
| 299 | +csharp_style_var_when_type_is_apparent = true:warning |
| 300 | +csharp_style_var_elsewhere = true:warning |
| 301 | + |
| 302 | +# csharp_style_allow_embedded_statements_on_same_line_experimental |
| 303 | +dotnet_diagnostic.IDE2001.severity = warning |
| 304 | + |
| 305 | +# csharp_style_allow_blank_lines_between_consecutive_braces_experimental |
| 306 | +dotnet_diagnostic.IDE2002.severity = warning |
| 307 | + |
| 308 | +# csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental |
| 309 | +dotnet_diagnostic.IDE2004.severity = warning |
| 310 | + |
| 311 | +# csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental |
| 312 | +dotnet_diagnostic.IDE2005.severity = warning |
| 313 | + |
| 314 | +# csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental |
| 315 | +dotnet_diagnostic.IDE2006.severity = warning |
| 316 | + |
| 317 | +[src/{VisualStudio}/**/*.{cs,vb}] |
| 318 | +# CA1822: Make member static |
| 319 | +# There is a risk of accidentally breaking an internal API that partners rely on though IVT. |
| 320 | +dotnet_code_quality.CA1822.api_surface = private |
0 commit comments