.editorconfig 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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. # C# files
  12. [*.cs]
  13. # New line preferences
  14. csharp_new_line_before_open_brace = all
  15. csharp_new_line_before_else = true
  16. csharp_new_line_before_catch = true
  17. csharp_new_line_before_finally = true
  18. csharp_new_line_before_members_in_object_initializers = true
  19. csharp_new_line_before_members_in_anonymous_types = true
  20. csharp_new_line_between_query_expression_clauses = true
  21. # trim_trailing_whitespace = true
  22. # Indentation preferences
  23. csharp_indent_block_contents = true
  24. csharp_indent_braces = false
  25. csharp_indent_case_contents = true
  26. csharp_indent_switch_labels = true
  27. csharp_indent_labels = one_less_than_current
  28. # avoid this. unless absolutely necessary
  29. dotnet_style_qualification_for_field = false:suggestion
  30. dotnet_style_qualification_for_property = false:suggestion
  31. dotnet_style_qualification_for_method = false:suggestion
  32. dotnet_style_qualification_for_event = false:suggestion
  33. # prefer var
  34. csharp_style_var_for_built_in_types = true
  35. csharp_style_var_when_type_is_apparent = true
  36. csharp_style_var_elsewhere = true:suggestion
  37. # use language keywords instead of BCL types
  38. dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
  39. dotnet_style_predefined_type_for_member_access = true:suggestion
  40. # name all constant fields using PascalCase
  41. dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
  42. dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
  43. dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
  44. dotnet_naming_symbols.constant_fields.applicable_kinds = field
  45. dotnet_naming_symbols.constant_fields.required_modifiers = const
  46. dotnet_naming_style.pascal_case_style.capitalization = pascal_case
  47. # private static fields should have s_ prefix
  48. dotnet_naming_rule.private_static_fields_should_have_prefix.severity = suggestion
  49. dotnet_naming_rule.private_static_fields_should_have_prefix.symbols = private_static_fields
  50. dotnet_naming_rule.private_static_fields_should_have_prefix.style = private_static_prefix_style
  51. dotnet_naming_symbols.private_static_fields.applicable_kinds = field
  52. dotnet_naming_symbols.private_static_fields.required_modifiers = static
  53. dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private
  54. dotnet_naming_style.private_static_prefix_style.required_prefix = s_
  55. dotnet_naming_style.private_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. # use accessibility modifiers
  65. dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
  66. # Code style defaults
  67. dotnet_sort_system_directives_first = true
  68. csharp_preserve_single_line_blocks = true
  69. csharp_preserve_single_line_statements = false
  70. # Expression-level preferences
  71. dotnet_style_object_initializer = true:suggestion
  72. dotnet_style_collection_initializer = true:suggestion
  73. dotnet_style_explicit_tuple_names = true:suggestion
  74. dotnet_style_coalesce_expression = true:suggestion
  75. dotnet_style_null_propagation = true:suggestion
  76. # Expression-bodied members
  77. csharp_style_expression_bodied_methods = false:none
  78. csharp_style_expression_bodied_constructors = false:none
  79. csharp_style_expression_bodied_operators = false:none
  80. csharp_style_expression_bodied_properties = true:none
  81. csharp_style_expression_bodied_indexers = true:none
  82. csharp_style_expression_bodied_accessors = true:none
  83. # Pattern matching
  84. csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
  85. csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
  86. csharp_style_inlined_variable_declaration = true:suggestion
  87. # Null checking preferences
  88. csharp_style_throw_expression = true:suggestion
  89. csharp_style_conditional_delegate_call = true:suggestion
  90. # Space preferences
  91. csharp_space_after_cast = false
  92. csharp_space_after_colon_in_inheritance_clause = true
  93. csharp_space_after_comma = true
  94. csharp_space_after_dot = false
  95. csharp_space_after_keywords_in_control_flow_statements = true
  96. csharp_space_after_semicolon_in_for_statement = true
  97. csharp_space_around_binary_operators = before_and_after
  98. csharp_space_around_declaration_statements = false
  99. csharp_space_before_colon_in_inheritance_clause = true
  100. csharp_space_before_comma = false
  101. csharp_space_before_dot = false
  102. csharp_space_before_open_square_brackets = false
  103. csharp_space_before_semicolon_in_for_statement = false
  104. csharp_space_between_empty_square_brackets = false
  105. csharp_space_between_method_call_empty_parameter_list_parentheses = false
  106. csharp_space_between_method_call_name_and_opening_parenthesis = false
  107. csharp_space_between_method_call_parameter_list_parentheses = false
  108. csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
  109. csharp_space_between_method_declaration_name_and_open_parenthesis = false
  110. csharp_space_between_method_declaration_parameter_list_parentheses = false
  111. csharp_space_between_parentheses = false
  112. csharp_space_between_square_brackets = false
  113. space_within_single_line_array_initializer_braces = true
  114. #Net Analyzer
  115. dotnet_analyzer_diagnostic.category-Performance.severity = none #error - Uncomment when all violations are fixed.
  116. # CS0649: Field 'field' is never assigned to, and will always have its default value 'value'
  117. dotnet_diagnostic.CS0649.severity = error
  118. # CS1591: Missing XML comment for publicly visible type or member
  119. dotnet_diagnostic.CS1591.severity = suggestion
  120. # CS0162: Remove unreachable code
  121. dotnet_diagnostic.CS0162.severity = error
  122. # CA1018: Mark attributes with AttributeUsageAttribute
  123. dotnet_diagnostic.CA1018.severity = error
  124. # CA1304: Specify CultureInfo
  125. dotnet_diagnostic.CA1304.severity = warning
  126. # CA1802: Use literals where appropriate
  127. dotnet_diagnostic.CA1802.severity = warning
  128. # CA1813: Avoid unsealed attributes
  129. dotnet_diagnostic.CA1813.severity = error
  130. # CA1815: Override equals and operator equals on value types
  131. dotnet_diagnostic.CA1815.severity = warning
  132. # CA1820: Test for empty strings using string length
  133. dotnet_diagnostic.CA1820.severity = warning
  134. # CA1821: Remove empty finalizers
  135. dotnet_diagnostic.CA1821.severity = error
  136. # CA1822: Mark members as static
  137. dotnet_diagnostic.CA1822.severity = suggestion
  138. dotnet_code_quality.CA1822.api_surface = private, internal
  139. # CA1823: Avoid unused private fields
  140. dotnet_diagnostic.CA1823.severity = error
  141. # CA1825: Avoid zero-length array allocations
  142. dotnet_diagnostic.CA1825.severity = warning
  143. # CA1826: Use property instead of Linq Enumerable method
  144. dotnet_diagnostic.CA1826.severity = suggestion
  145. # CA1827: Do not use Count/LongCount when Any can be used
  146. dotnet_diagnostic.CA1827.severity = warning
  147. # CA1828: Do not use CountAsync/LongCountAsync when AnyAsync can be used
  148. dotnet_diagnostic.CA1828.severity = warning
  149. # CA1829: Use Length/Count property instead of Enumerable.Count method
  150. dotnet_diagnostic.CA1829.severity = warning
  151. #CA1847: Use string.Contains(char) instead of string.Contains(string) with single characters
  152. dotnet_diagnostic.CA1847.severity = warning
  153. # CA1851: Possible multiple enumerations of IEnumerable collection
  154. dotnet_diagnostic.CA1851.severity = warning
  155. #CA1854: Prefer the IDictionary.TryGetValue(TKey, out TValue) method
  156. dotnet_diagnostic.CA1854.severity = warning
  157. #CA2211:Non-constant fields should not be visible
  158. dotnet_diagnostic.CA2211.severity = error
  159. # Wrapping preferences
  160. csharp_wrap_before_ternary_opsigns = false
  161. # Avalonia DevAnalyzer preferences
  162. dotnet_diagnostic.AVADEV2001.severity = error
  163. # Avalonia PublicAnalyzer preferences
  164. dotnet_diagnostic.AVP1000.severity = error
  165. dotnet_diagnostic.AVP1001.severity = error
  166. dotnet_diagnostic.AVP1002.severity = error
  167. dotnet_diagnostic.AVP1010.severity = error
  168. dotnet_diagnostic.AVP1011.severity = error
  169. dotnet_diagnostic.AVP1012.severity = warning
  170. dotnet_diagnostic.AVP1013.severity = error
  171. dotnet_diagnostic.AVP1020.severity = error
  172. dotnet_diagnostic.AVP1021.severity = error
  173. dotnet_diagnostic.AVP1022.severity = error
  174. dotnet_diagnostic.AVP1030.severity = error
  175. dotnet_diagnostic.AVP1031.severity = error
  176. dotnet_diagnostic.AVP1032.severity = error
  177. dotnet_diagnostic.AVP1040.severity = error
  178. dotnet_diagnostic.AVA2001.severity = error
  179. # Xaml files
  180. [*.{xaml,axaml}]
  181. indent_size = 2
  182. # DuplicateSetterError
  183. avalonia_xaml_diagnostic.AVLN2203.severity = error
  184. # StyleInMergedDictionaries
  185. avalonia_xaml_diagnostic.AVLN2204.severity = error
  186. # RequiredTemplatePartMissing
  187. avalonia_xaml_diagnostic.AVLN2205.severity = error
  188. # OptionalTemplatePartMissing
  189. avalonia_xaml_diagnostic.AVLN2206.severity = info
  190. # TemplatePartWrongType
  191. avalonia_xaml_diagnostic.AVLN2207.severity = error
  192. # ItemContainerInsideTemplate
  193. avalonia_xaml_diagnostic.AVLN2208.severity = error
  194. # Obsolete
  195. avalonia_xaml_diagnostic.AVLN5001.severity = error
  196. # Xml project files
  197. [*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
  198. indent_size = 2
  199. # Xml build files
  200. [*.builds]
  201. indent_size = 2
  202. # Xml files
  203. [*.{xml,stylecop,resx,ruleset}]
  204. indent_size = 2
  205. # Xml config files
  206. [*.{props,targets,config,nuspec}]
  207. indent_size = 2
  208. [*.json]
  209. indent_size = 2
  210. # Shell scripts
  211. [*.sh]
  212. end_of_line = lf
  213. [*.{cmd,bat}]
  214. end_of_line = crlf