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.

380 lines
20 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. # Version 20221025
  2. # This file does not inherit .editorconfig settings from higher directories - where possible, place it at the root of the repository
  3. # References:
  4. # - To learn more about .editorconfig see https://aka.ms/editorconfigdocs
  5. # - Set rule severity https://docs.microsoft.com/en-us/visualstudio/code-quality/use-roslyn-analyzers?view=vs-2019#set-rule-severity-in-an-editorconfig-file
  6. # - Configure analyzer rules https://github.com/dotnet/roslyn-analyzers/blob/main/docs/Analyzer%20Configuration.md
  7. ###############################
  8. # Core EditorConfig Options #
  9. ###############################
  10. root = true
  11. # All files
  12. [*]
  13. indent_style = space
  14. # Line endings are different from Visual Studio for Windows .editorconfig template defaults; see comments in EOL.gitattributes for rationale
  15. end_of_line = lf
  16. # Code files
  17. [*.{cs,csx,vb,vbx}]
  18. indent_size = 4
  19. insert_final_newline = true
  20. charset = utf-8-bom
  21. ###############################################################
  22. # Different from VS2022 .NET .editorconfig template defaults #
  23. # Defaults are left in their original location, commented out #
  24. # with comment prefix "# Default: <original>" #
  25. ###############################################################
  26. # Note that choices to deviate from the default are governed by these goals:
  27. # 1) Remove noise
  28. # 2) Increase conciseness
  29. dotnet_style_qualification_for_field = false:warning
  30. dotnet_style_qualification_for_property = false:warning
  31. dotnet_style_qualification_for_method = false:warning
  32. dotnet_style_qualification_for_event = false:warning
  33. dotnet_style_predefined_type_for_locals_parameters_members = true:warning
  34. dotnet_style_predefined_type_for_member_access = true:warning
  35. dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning
  36. dotnet_style_readonly_field = true:warning
  37. csharp_style_expression_bodied_methods = true:warning
  38. csharp_style_expression_bodied_constructors = true:warning
  39. csharp_style_expression_bodied_operators = true:warning
  40. csharp_style_expression_bodied_properties = true:warning
  41. csharp_style_expression_bodied_indexers = true:warning
  42. csharp_style_expression_bodied_accessors = true:warning
  43. dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
  44. dotnet_style_prefer_inferred_tuple_names = true:warning
  45. dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
  46. dotnet_style_prefer_auto_properties = true:warning
  47. dotnet_style_prefer_conditional_expression_over_assignment = true:silent # We want true:suggestion but that does not work, so we specify the severity in the next line:
  48. dotnet_diagnostic.IDE0045.severity = suggestion
  49. dotnet_style_prefer_conditional_expression_over_return = true:silent # We want true:suggestion but that does not work, so we specify the severity in the next line:
  50. dotnet_diagnostic.IDE0046.severity = suggestion
  51. csharp_style_deconstructed_variable_declaration = true:warning
  52. csharp_prefer_simple_default_expression = true:warning
  53. csharp_style_pattern_local_over_anonymous_function = true:warning
  54. csharp_style_inlined_variable_declaration = true:warning
  55. csharp_using_directive_placement = outside_namespace:warning
  56. # Placing usings outside namespaces lets the closest parent namespace control type name match
  57. # It can also make attribute usage more concise
  58. # See https://stackoverflow.com/questions/125319/should-using-directives-be-inside-or-outside-the-namespace
  59. csharp_style_namespace_declarations = file_scoped:warning
  60. csharp_style_prefer_method_group_conversion = true:warning
  61. csharp_style_expression_bodied_lambdas = true:warning
  62. csharp_style_expression_bodied_local_functions = false:warning
  63. csharp_style_prefer_null_check_over_type_check = true:warning
  64. csharp_style_prefer_local_over_anonymous_function = true:warning
  65. csharp_style_prefer_index_operator = true:warning
  66. csharp_style_prefer_range_operator = true:warning
  67. csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
  68. csharp_style_prefer_tuple_swap = true:warning
  69. csharp_style_unused_value_assignment_preference = discard_variable:warning
  70. csharp_style_unused_value_expression_statement_preference = discard_variable:warning
  71. csharp_prefer_static_local_function = true:warning
  72. dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = warning
  73. csharp_style_var_for_built_in_types = true
  74. csharp_style_var_when_type_is_apparent = true
  75. csharp_style_var_elsewhere = true
  76. dotnet_diagnostic.CA1848.severity = suggestion # Not every logging statement needs to be optimized for performance
  77. dotnet_diagnostic.CA1708.severity = none # CA1708 is not relevant because we do not design binary API's for other languages than C#. See https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1708
  78. dotnet_diagnostic.CA1716.severity = none # CA1716 is not relevant because we do not design binary API's for other languages than C#. See https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1716
  79. dotnet_diagnostic.IDE0130.severity = suggestion # IDE0130 "Namespace does not match folder structure" can be deviated from to prevent overstructuring
  80. dotnet_diagnostic.IDE0055.severity = silent # Nonstandard whitespace formatting can be used to improve readability
  81. dotnet_diagnostic.IDE0072.severity = suggestion
  82. # Populate switch: switch options should be exhaustive for all expected functionality including expected errors,
  83. # while truly unexpected returns should throw an exception. Since switch automatically throws a SwitchExpressionException,
  84. # it is valid to not explicitly code cases that throw an exception to indicate the return is truly unexpected.
  85. # Start of NO underscore prefix on private fields
  86. # Define the 'private_fields' symbol group:
  87. dotnet_naming_symbols.private_fields.applicable_kinds = field
  88. dotnet_naming_symbols.private_fields.applicable_accessibilities = private
  89. # Define the 'notunderscored' naming style
  90. dotnet_naming_style.notunderscored.capitalization = camel_case
  91. dotnet_naming_style.notunderscored.required_prefix =
  92. # Define the 'private_fields_notunderscored' naming rule
  93. dotnet_naming_rule.private_fields_notunderscored.symbols = private_fields
  94. dotnet_naming_rule.private_fields_notunderscored.style = notunderscored
  95. dotnet_naming_rule.private_fields_notunderscored.severity = error
  96. # End of No underscore prefix on private fields
  97. ###############################
  98. # .NET Coding Conventions #
  99. ###############################
  100. [*.{cs,vb}]
  101. # Organize usings
  102. dotnet_sort_system_directives_first = true
  103. # this. preferences
  104. # Default: dotnet_style_qualification_for_field = false:silent
  105. # Default: dotnet_style_qualification_for_property = false:silent
  106. # Default: dotnet_style_qualification_for_method = false:silent
  107. # Default: dotnet_style_qualification_for_event = false:silent
  108. # Language keywords vs BCL types preferences
  109. # Default: dotnet_style_predefined_type_for_locals_parameters_members = true:silent
  110. # Default: dotnet_style_predefined_type_for_member_access = true:silent
  111. # Parentheses preferences
  112. dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
  113. dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
  114. dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
  115. dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
  116. # Modifier preferences
  117. # Default: dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
  118. # Default: dotnet_style_readonly_field = true:suggestion
  119. # Expression-level preferences
  120. dotnet_style_object_initializer = true:suggestion
  121. dotnet_style_collection_initializer = true:suggestion
  122. dotnet_style_explicit_tuple_names = true:suggestion
  123. dotnet_style_null_propagation = true:suggestion
  124. dotnet_style_coalesce_expression = true:suggestion
  125. # Default: dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
  126. # Default: dotnet_style_prefer_inferred_tuple_names = true:suggestion
  127. # Default: dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
  128. # Default: dotnet_style_prefer_auto_properties = true:silent
  129. # Default: dotnet_style_prefer_conditional_expression_over_assignment = true:silent
  130. # Default: dotnet_style_prefer_conditional_expression_over_return = true:silent
  131. ###############################
  132. # Naming Conventions #
  133. ###############################
  134. # Style Definitions
  135. dotnet_naming_style.pascal_case_style.capitalization = pascal_case
  136. # Use PascalCase for constant fields
  137. # Default: dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
  138. dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
  139. dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
  140. dotnet_naming_symbols.constant_fields.applicable_kinds = field
  141. dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
  142. dotnet_naming_symbols.constant_fields.required_modifiers = const
  143. ###############################
  144. # C# Coding Conventions #
  145. ###############################
  146. [*.cs]
  147. # var preferences
  148. # Default: csharp_style_var_for_built_in_types = true:silent
  149. # Default: csharp_style_var_when_type_is_apparent = true:silent
  150. # Default: csharp_style_var_elsewhere = true:silent
  151. # Expression-bodied members
  152. # Default: csharp_style_expression_bodied_methods = false:silent
  153. # Default: csharp_style_expression_bodied_constructors = false:silent
  154. # Default: csharp_style_expression_bodied_operators = false:silent
  155. # Default: csharp_style_expression_bodied_properties = true:silent
  156. # Default: csharp_style_expression_bodied_indexers = true:silent
  157. # Default: csharp_style_expression_bodied_accessors = true:silent
  158. # Pattern matching preferences
  159. csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
  160. csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
  161. # Null-checking preferences
  162. csharp_style_throw_expression = true:suggestion
  163. csharp_style_conditional_delegate_call = true:suggestion
  164. # Modifier preferences
  165. csharp_preferred_modifier_order = public, private, protected, internal, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, volatile, async:suggestion
  166. # Expression-level preferences
  167. csharp_prefer_braces = when_multiline:suggestion
  168. # Default: csharp_style_deconstructed_variable_declaration = true:suggestion
  169. # Default: csharp_prefer_simple_default_expression = true:suggestion
  170. # Default: csharp_style_pattern_local_over_anonymous_function = true:suggestion
  171. # Default: csharp_style_inlined_variable_declaration = true:suggestion
  172. ###############################
  173. # C# Formatting Rules #
  174. ###############################
  175. # New line preferences
  176. csharp_new_line_before_open_brace = all
  177. csharp_new_line_before_else = true
  178. csharp_new_line_before_catch = true
  179. csharp_new_line_before_finally = true
  180. csharp_new_line_before_members_in_object_initializers = true
  181. csharp_new_line_before_members_in_anonymous_types = true
  182. csharp_new_line_between_query_expression_clauses = true
  183. # Indentation preferences
  184. csharp_indent_case_contents = true
  185. csharp_indent_switch_labels = true
  186. csharp_indent_labels = one_less_than_current
  187. # Space preferences
  188. csharp_space_after_cast = false
  189. csharp_space_after_keywords_in_control_flow_statements = true
  190. csharp_space_between_method_call_parameter_list_parentheses = false
  191. csharp_space_between_method_declaration_parameter_list_parentheses = false
  192. csharp_space_between_parentheses = false
  193. csharp_space_before_colon_in_inheritance_clause = true
  194. csharp_space_after_colon_in_inheritance_clause = true
  195. csharp_space_around_binary_operators = before_and_after
  196. csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
  197. csharp_space_between_method_call_name_and_opening_parenthesis = false
  198. csharp_space_between_method_call_empty_parameter_list_parentheses = false
  199. # Wrapping preferences
  200. csharp_preserve_single_line_statements = true
  201. csharp_preserve_single_line_blocks = true
  202. # Default: csharp_using_directive_placement = outside_namespace:silent
  203. csharp_prefer_simple_using_statement = true:suggestion
  204. # Default: csharp_style_namespace_declarations = block_scoped:silent
  205. # Default: csharp_style_prefer_method_group_conversion = true:silent
  206. csharp_style_prefer_top_level_statements = true:silent
  207. csharp_style_expression_bodied_methods = false:warning
  208. csharp_style_expression_bodied_constructors = false:warning
  209. csharp_style_expression_bodied_operators = true:warning
  210. csharp_style_expression_bodied_properties = true:warning
  211. csharp_style_expression_bodied_indexers = true:warning
  212. csharp_style_expression_bodied_accessors = true:warning
  213. # Default: csharp_style_expression_bodied_lambdas = true:silent
  214. # Default: csharp_style_expression_bodied_local_functions = false:silent
  215. # Default: csharp_style_prefer_null_check_over_type_check = true:suggestion
  216. # Default: csharp_style_prefer_local_over_anonymous_function = true:suggestion
  217. # Default: csharp_style_prefer_index_operator = true:suggestion
  218. # Default: csharp_style_prefer_range_operator = true:suggestion
  219. # Default: csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
  220. # Default: csharp_style_prefer_tuple_swap = true:suggestion
  221. # Default: csharp_style_unused_value_assignment_preference = discard_variable:suggestion
  222. # Default: csharp_style_unused_value_expression_statement_preference = discard_variable:silent
  223. # Default: csharp_prefer_static_local_function = true:suggestion
  224. csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent
  225. csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent
  226. csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent
  227. csharp_style_prefer_parameter_null_checking = true:suggestion
  228. csharp_using_directive_placement = outside_namespace:warning
  229. csharp_style_namespace_declarations = file_scoped:warning
  230. csharp_style_prefer_method_group_conversion = true:warning
  231. csharp_style_prefer_primary_constructors = true:suggestion
  232. csharp_style_expression_bodied_lambdas = when_on_single_line:warning
  233. csharp_style_expression_bodied_local_functions = false:warning
  234. csharp_style_prefer_null_check_over_type_check = true:warning
  235. csharp_style_prefer_local_over_anonymous_function = true:warning
  236. csharp_prefer_simple_default_expression = true:warning
  237. csharp_style_prefer_index_operator = true:warning
  238. csharp_style_prefer_range_operator = true:warning
  239. csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
  240. csharp_style_prefer_tuple_swap = true:warning
  241. csharp_style_prefer_utf8_string_literals = true:suggestion
  242. csharp_style_deconstructed_variable_declaration = true:warning
  243. csharp_style_inlined_variable_declaration = true:warning
  244. csharp_style_unused_value_expression_statement_preference = discard_variable:warning
  245. csharp_style_unused_value_assignment_preference = discard_variable:warning
  246. csharp_style_prefer_readonly_struct = true:suggestion
  247. csharp_prefer_static_local_function = true:warning
  248. csharp_style_prefer_readonly_struct_member = true:suggestion
  249. csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
  250. csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
  251. csharp_style_prefer_pattern_matching = true:suggestion
  252. csharp_style_prefer_switch_expression = true:suggestion
  253. csharp_style_prefer_extended_property_pattern = true:suggestion
  254. csharp_style_prefer_not_pattern = true:suggestion
  255. csharp_style_var_for_built_in_types = true:warning
  256. csharp_style_var_when_type_is_apparent = true:warning
  257. csharp_style_var_elsewhere = true:warning
  258. dotnet_diagnostic.MA0007.severity = silent
  259. dotnet_diagnostic.MA0026.severity = suggestion
  260. ###############################
  261. # VB Coding Conventions #
  262. ###############################
  263. [*.vb]
  264. # Modifier preferences
  265. visual_basic_preferred_modifier_order = Partial, Default, Private, Protected, Public, Friend, NotOverridable, Overridable, MustOverride, Overloads, Overrides, MustInherit, NotInheritable, Static, Shared, Shadows, ReadOnly, WriteOnly, Dim, Const, WithEvents, Widening, Narrowing, Custom, Async:suggestion
  266. [*.{cs,vb}]
  267. #### Naming styles ####
  268. # Naming rules
  269. dotnet_naming_rule.interface_should_be_begins_with_i.severity = error
  270. dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
  271. dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
  272. dotnet_naming_rule.types_should_be_pascal_case.severity = warning
  273. dotnet_naming_rule.types_should_be_pascal_case.symbols = types
  274. dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
  275. dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning
  276. dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
  277. dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
  278. # Symbol specifications
  279. dotnet_naming_symbols.interface.applicable_kinds = interface
  280. dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
  281. dotnet_naming_symbols.interface.required_modifiers =
  282. dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
  283. dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
  284. dotnet_naming_symbols.types.required_modifiers =
  285. dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
  286. dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
  287. dotnet_naming_symbols.non_field_members.required_modifiers =
  288. # Naming styles
  289. dotnet_naming_style.begins_with_i.required_prefix = I
  290. dotnet_naming_style.begins_with_i.required_suffix =
  291. dotnet_naming_style.begins_with_i.word_separator =
  292. dotnet_naming_style.begins_with_i.capitalization = pascal_case
  293. dotnet_naming_style.pascal_case.required_prefix =
  294. dotnet_naming_style.pascal_case.required_suffix =
  295. dotnet_naming_style.pascal_case.word_separator =
  296. dotnet_naming_style.pascal_case.capitalization = pascal_case
  297. dotnet_naming_style.pascal_case.required_prefix =
  298. dotnet_naming_style.pascal_case.required_suffix =
  299. dotnet_naming_style.pascal_case.word_separator =
  300. dotnet_naming_style.pascal_case.capitalization = pascal_case
  301. dotnet_style_operator_placement_when_wrapping = beginning_of_line
  302. tab_width = 4
  303. dotnet_style_prefer_simplified_boolean_expressions = true:warning
  304. dotnet_style_prefer_compound_assignment = true:warning
  305. dotnet_style_prefer_simplified_interpolation = true:warning
  306. dotnet_style_namespace_match_folder = true:warning
  307. dotnet_style_allow_multiple_blank_lines_experimental = true:silent
  308. dotnet_style_allow_statement_immediately_after_block_experimental = true:silent
  309. dotnet_code_quality_unused_parameters = all:warning
  310. # Additional settings exported from VS 17.4.0 Preview 4.0:
  311. csharp_indent_block_contents = true
  312. csharp_indent_braces = false
  313. csharp_indent_labels = one_less_than_current
  314. csharp_space_after_comma = true
  315. csharp_space_after_dot = false
  316. csharp_space_after_semicolon_in_for_statement = true
  317. csharp_space_around_declaration_statements = false
  318. csharp_space_before_comma = false
  319. csharp_space_before_dot = false
  320. csharp_space_before_open_square_brackets = false
  321. csharp_space_before_semicolon_in_for_statement = false
  322. csharp_space_between_empty_square_brackets = false
  323. csharp_space_between_method_declaration_name_and_open_parenthesis = false
  324. csharp_space_between_square_brackets = false
  325. csharp_style_prefer_not_pattern = true
  326. csharp_style_prefer_readonly_struct = true
  327. csharp_style_prefer_switch_expression = true
  328. csharp_style_prefer_utf8_string_literals = true
  329. dotnet_remove_unnecessary_suppression_exclusions = none
  330. dotnet_separate_import_directive_groups = false
  331. dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed
  332. MA0051.maximum_lines_per_method = 150
  333. MA0051.maximum_statements_per_method = 70