You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

174 lines
6.3 KiB

  1. # editorconfig.org
  2. # top-most EditorConfig file
  3. root = true
  4. # Default settings:
  5. # A newline ending every file
  6. # Use 4 spaces as indentation
  7. [*]
  8. insert_final_newline = true
  9. indent_style = space
  10. indent_size = 4
  11. [*.{json,jsonc}]
  12. indent_size = 2
  13. # C# files
  14. [*.cs]
  15. # New line preferences
  16. csharp_new_line_before_open_brace = all
  17. csharp_new_line_before_else = true
  18. csharp_new_line_before_catch = true
  19. csharp_new_line_before_finally = true
  20. csharp_new_line_before_members_in_object_initializers = true
  21. csharp_new_line_before_members_in_anonymous_types = true
  22. csharp_new_line_between_query_expression_clauses = true
  23. # Indentation preferences
  24. csharp_indent_block_contents = true
  25. csharp_indent_braces = false
  26. csharp_indent_case_contents = true
  27. csharp_indent_switch_labels = true
  28. csharp_indent_labels = one_less_than_current
  29. # avoid this. unless absolutely necessary
  30. dotnet_style_qualification_for_field = false:suggestion
  31. dotnet_style_qualification_for_property = false:suggestion
  32. dotnet_style_qualification_for_method = false:suggestion
  33. dotnet_style_qualification_for_event = false:suggestion
  34. # only use var when it's obvious what the variable type is
  35. csharp_style_var_for_built_in_types = false:none
  36. csharp_style_var_when_type_is_apparent = false:none
  37. csharp_style_var_elsewhere = false:suggestion
  38. # use language keywords instead of BCL types
  39. dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
  40. dotnet_style_predefined_type_for_member_access = true:suggestion
  41. # name all constant fields using PascalCase
  42. dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
  43. dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
  44. dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
  45. dotnet_naming_symbols.constant_fields.applicable_kinds = field
  46. dotnet_naming_symbols.constant_fields.required_modifiers = const
  47. dotnet_naming_style.pascal_case_style.capitalization = pascal_case
  48. # static fields should have s_ prefix
  49. dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
  50. dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
  51. dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
  52. dotnet_naming_symbols.static_fields.applicable_kinds = field
  53. dotnet_naming_symbols.static_fields.required_modifiers = static
  54. dotnet_naming_style.static_prefix_style.required_prefix = s_
  55. dotnet_naming_style.static_prefix_style.capitalization = camel_case
  56. # internal and private fields should be _camelCase
  57. dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
  58. dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
  59. dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
  60. dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
  61. dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
  62. dotnet_naming_style.camel_case_underscore_style.required_prefix = _
  63. dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
  64. # Code style defaults
  65. dotnet_sort_system_directives_first = true
  66. csharp_preserve_single_line_blocks = true
  67. csharp_preserve_single_line_statements = false
  68. # Expression-level preferences
  69. dotnet_style_object_initializer = true:suggestion
  70. dotnet_style_collection_initializer = true:suggestion
  71. dotnet_style_explicit_tuple_names = true:suggestion
  72. dotnet_style_coalesce_expression = true:suggestion
  73. dotnet_style_null_propagation = true:suggestion
  74. # Expression-bodied members
  75. csharp_style_expression_bodied_methods = false:none
  76. csharp_style_expression_bodied_constructors = false:none
  77. csharp_style_expression_bodied_operators = false:none
  78. csharp_style_expression_bodied_properties = true:none
  79. csharp_style_expression_bodied_indexers = true:none
  80. csharp_style_expression_bodied_accessors = true:none
  81. # Pattern matching
  82. csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
  83. csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
  84. csharp_style_inlined_variable_declaration = true:suggestion
  85. # Null checking preferences
  86. csharp_style_throw_expression = true:suggestion
  87. csharp_style_conditional_delegate_call = true:suggestion
  88. # Space preferences
  89. csharp_space_after_cast = false
  90. csharp_space_after_colon_in_inheritance_clause = true
  91. csharp_space_after_comma = true
  92. csharp_space_after_dot = false
  93. csharp_space_after_keywords_in_control_flow_statements = true
  94. csharp_space_after_semicolon_in_for_statement = true
  95. csharp_space_around_binary_operators = before_and_after
  96. csharp_space_around_declaration_statements = do_not_ignore
  97. csharp_space_before_colon_in_inheritance_clause = true
  98. csharp_space_before_comma = false
  99. csharp_space_before_dot = false
  100. csharp_space_before_open_square_brackets = false
  101. csharp_space_before_semicolon_in_for_statement = false
  102. csharp_space_between_empty_square_brackets = false
  103. csharp_space_between_method_call_empty_parameter_list_parentheses = false
  104. csharp_space_between_method_call_name_and_opening_parenthesis = false
  105. csharp_space_between_method_call_parameter_list_parentheses = false
  106. csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
  107. csharp_space_between_method_declaration_name_and_open_parenthesis = false
  108. csharp_space_between_method_declaration_parameter_list_parentheses = false
  109. csharp_space_between_parentheses = false
  110. csharp_space_between_square_brackets = false
  111. # Analyzers
  112. dotnet_code_quality.ca1802.api_surface = private, internal
  113. # CA2000: Dispose objects before losing scope
  114. dotnet_diagnostic.CA2000.severity = suggestion
  115. # CA1063: Implement IDisposable Correctly
  116. dotnet_diagnostic.CA1063.severity = silent
  117. # CA2100: Review SQL queries for security vulnerabilities
  118. dotnet_diagnostic.CA2100.severity = silent
  119. # CA1416: Validate platform compatibility
  120. dotnet_diagnostic.CA1416.severity = silent
  121. dotnet_code_quality.CA2100.excluded_type_names_with_derived_types = Microsoft.Data.SqlClient.ManualTesting.Tests.*
  122. dotnet_diagnostic.xUnit1031.severity=none
  123. dotnet_diagnostic.xUnit1030.severity=none
  124. [*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
  125. indent_size = 2
  126. # Xml build files
  127. [*.builds]
  128. indent_size = 2
  129. # Xml files
  130. [*.{xml,stylecop,resx,ruleset}]
  131. indent_size = 2
  132. # Xml config files
  133. [*.{props,targets,config,nuspec}]
  134. indent_size = 2
  135. # Shell scripts
  136. [*.sh]
  137. end_of_line = lf
  138. [*.{cmd, bat}]
  139. end_of_line = crlf