.editorconfig 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. # Remove the line below if you want to inherit .editorconfig settings from higher directories
  2. root = true
  3. [*]
  4. #### Core EditorConfig Options ####
  5. # Indentation and spacing
  6. indent_size = 4
  7. indent_style = space
  8. tab_width = 4
  9. # New line preferences
  10. end_of_line = lf
  11. insert_final_newline = true
  12. # JSON files
  13. [*.json]
  14. # Indentation and spacing
  15. indent_size = 2
  16. tab_width = 2
  17. # C# files
  18. [*.cs]
  19. #### .NET Coding Conventions ####
  20. # Organize usings
  21. dotnet_separate_import_directive_groups = false
  22. dotnet_sort_system_directives_first = false
  23. # this. and Me. preferences
  24. dotnet_style_qualification_for_event = false:silent
  25. dotnet_style_qualification_for_field = false:silent
  26. dotnet_style_qualification_for_method = false:silent
  27. dotnet_style_qualification_for_property = false:silent
  28. # Language keywords vs BCL types preferences
  29. dotnet_style_predefined_type_for_locals_parameters_members = true:silent
  30. dotnet_style_predefined_type_for_member_access = true:silent
  31. # Parentheses preferences
  32. dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
  33. dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
  34. dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
  35. dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
  36. # Modifier preferences
  37. dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
  38. # Expression-level preferences
  39. dotnet_style_coalesce_expression = true:suggestion
  40. dotnet_style_collection_initializer = true:suggestion
  41. dotnet_style_explicit_tuple_names = true:suggestion
  42. dotnet_style_null_propagation = true:suggestion
  43. dotnet_style_object_initializer = true:suggestion
  44. dotnet_style_prefer_auto_properties = true:silent
  45. dotnet_style_prefer_compound_assignment = true:suggestion
  46. dotnet_style_prefer_conditional_expression_over_assignment = true:silent
  47. dotnet_style_prefer_conditional_expression_over_return = true:silent
  48. dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
  49. dotnet_style_prefer_inferred_tuple_names = true:suggestion
  50. dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
  51. dotnet_style_prefer_simplified_interpolation = true:suggestion
  52. # Field preferences
  53. dotnet_style_readonly_field = true:suggestion
  54. # Parameter preferences
  55. dotnet_code_quality_unused_parameters = all:silent
  56. #### C# Coding Conventions ####
  57. # Namespace preferences
  58. csharp_style_namespace_declarations = block_scoped:warning
  59. resharper_csharp_namespace_body = block_scoped
  60. # var preferences
  61. csharp_style_var_elsewhere = false:silent
  62. csharp_style_var_for_built_in_types = false:silent
  63. csharp_style_var_when_type_is_apparent = false:silent
  64. # Expression-bodied members
  65. csharp_style_expression_bodied_accessors = true:silent
  66. csharp_style_expression_bodied_constructors = false:silent
  67. csharp_style_expression_bodied_indexers = true:silent
  68. csharp_style_expression_bodied_lambdas = true:silent
  69. csharp_style_expression_bodied_local_functions = false:silent
  70. csharp_style_expression_bodied_methods = false:silent
  71. csharp_style_expression_bodied_operators = false:silent
  72. csharp_style_expression_bodied_properties = true:silent
  73. # Pattern matching preferences
  74. csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
  75. csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
  76. csharp_style_prefer_switch_expression = false:silent
  77. # Null-checking preferences
  78. csharp_style_conditional_delegate_call = true:suggestion
  79. # Modifier preferences
  80. csharp_prefer_static_local_function = true:suggestion
  81. csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent
  82. csharp_style_prefer_readonly_struct = true
  83. csharp_style_prefer_method_group_conversion = true
  84. # Code-block preferences
  85. csharp_prefer_braces = true:silent
  86. csharp_prefer_simple_using_statement = true:suggestion
  87. # Expression-level preferences
  88. csharp_prefer_simple_default_expression = true:suggestion
  89. csharp_style_deconstructed_variable_declaration = true:suggestion
  90. csharp_style_inlined_variable_declaration = true:suggestion
  91. csharp_style_pattern_local_over_anonymous_function = true:suggestion
  92. csharp_style_prefer_index_operator = true:suggestion
  93. csharp_style_prefer_range_operator = true:suggestion
  94. csharp_style_throw_expression = true:suggestion
  95. csharp_style_unused_value_assignment_preference = discard_variable:suggestion
  96. csharp_style_unused_value_expression_statement_preference = discard_variable:silent
  97. csharp_style_implicit_object_creation_when_type_is_apparent = true
  98. # 'using' directive preferences
  99. csharp_using_directive_placement = outside_namespace:silent
  100. #### C# Formatting Rules ####
  101. # New line preferences
  102. csharp_new_line_before_catch = true
  103. csharp_new_line_before_else = true
  104. csharp_new_line_before_finally = true
  105. csharp_new_line_before_members_in_anonymous_types = true
  106. csharp_new_line_before_members_in_object_initializers = true
  107. csharp_new_line_before_open_brace = all
  108. csharp_new_line_between_query_expression_clauses = true
  109. # Indentation preferences
  110. csharp_indent_block_contents = true
  111. csharp_indent_braces = false
  112. csharp_indent_case_contents = true
  113. csharp_indent_case_contents_when_block = true
  114. csharp_indent_labels = one_less_than_current
  115. csharp_indent_switch_labels = true
  116. # Space preferences
  117. csharp_space_after_cast = false
  118. csharp_space_after_colon_in_inheritance_clause = true
  119. csharp_space_after_comma = true
  120. csharp_space_after_dot = false
  121. csharp_space_after_keywords_in_control_flow_statements = true
  122. csharp_space_after_semicolon_in_for_statement = true
  123. csharp_space_around_binary_operators = before_and_after
  124. csharp_space_before_colon_in_inheritance_clause = true
  125. csharp_space_before_comma = false
  126. csharp_space_before_dot = false
  127. csharp_space_before_open_square_brackets = false
  128. csharp_space_before_semicolon_in_for_statement = false
  129. csharp_space_between_empty_square_brackets = false
  130. csharp_space_between_method_call_empty_parameter_list_parentheses = false
  131. csharp_space_between_method_call_name_and_opening_parenthesis = false
  132. csharp_space_between_method_call_parameter_list_parentheses = false
  133. csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
  134. csharp_space_between_method_declaration_name_and_open_parenthesis = false
  135. csharp_space_between_method_declaration_parameter_list_parentheses = false
  136. csharp_space_between_parentheses = false
  137. csharp_space_between_square_brackets = false
  138. # Wrapping preferences
  139. csharp_preserve_single_line_blocks = true
  140. csharp_preserve_single_line_statements = false
  141. #### Naming styles ####
  142. # Naming rules
  143. dotnet_naming_rule.interfaces_should_be_prefixed_with_I.severity = suggestion
  144. dotnet_naming_rule.interfaces_should_be_prefixed_with_I.symbols = interface
  145. dotnet_naming_rule.interfaces_should_be_prefixed_with_I.style = IPascalCase
  146. dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
  147. dotnet_naming_rule.types_should_be_pascal_case.symbols = types
  148. dotnet_naming_rule.types_should_be_pascal_case.style = PascalCase
  149. dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
  150. dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
  151. dotnet_naming_rule.non_field_members_should_be_pascal_case.style = PascalCase
  152. dotnet_naming_rule.private_static_readonly_fields_should_be_camel_case_and_prefixed_with__.symbols = private_static_readonly_fields
  153. dotnet_naming_rule.private_static_readonly_fields_should_be_camel_case_and_prefixed_with__.severity = suggestion
  154. dotnet_naming_rule.private_static_readonly_fields_should_be_camel_case_and_prefixed_with__.style = _camelCase
  155. dotnet_naming_rule.local_constants_should_be_pascal_case.symbols = local_constants
  156. dotnet_naming_rule.local_constants_should_be_pascal_case.severity = suggestion
  157. dotnet_naming_rule.local_constants_should_be_pascal_case.style = PascalCase
  158. # Symbol specifications
  159. dotnet_naming_symbols.interface.applicable_kinds = interface
  160. dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
  161. dotnet_naming_symbols.interface.required_modifiers =
  162. dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
  163. dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
  164. dotnet_naming_symbols.types.required_modifiers =
  165. dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
  166. dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
  167. dotnet_naming_symbols.non_field_members.required_modifiers =
  168. dotnet_naming_symbols.private_static_readonly_fields.applicable_kinds = field
  169. dotnet_naming_symbols.private_static_readonly_fields.applicable_accessibilities = private
  170. dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = static, readonly
  171. dotnet_naming_symbols.local_constants.applicable_kinds = local
  172. dotnet_naming_symbols.local_constants.applicable_accessibilities = local
  173. dotnet_naming_symbols.local_constants.required_modifiers = const
  174. # Naming styles
  175. dotnet_naming_style._camelCase.required_prefix = _
  176. dotnet_naming_style._camelCase.required_suffix =
  177. dotnet_naming_style._camelCase.word_separator =
  178. dotnet_naming_style._camelCase.capitalization = camel_case
  179. dotnet_naming_style.PascalCase.required_prefix =
  180. dotnet_naming_style.PascalCase.required_suffix =
  181. dotnet_naming_style.PascalCase.word_separator =
  182. dotnet_naming_style.PascalCase.capitalization = pascal_case
  183. dotnet_naming_style.IPascalCase.required_prefix = I
  184. dotnet_naming_style.IPascalCase.required_suffix =
  185. dotnet_naming_style.IPascalCase.word_separator =
  186. dotnet_naming_style.IPascalCase.capitalization = pascal_case
  187. # TODO:
  188. # .NET 8 migration (new warnings are caused by the NET 8 C# compiler and analyzer)
  189. # The following info messages might need to be fixed in the source code instead of hiding the actual message
  190. # Without the following lines, dotnet format would fail
  191. # Disable "Collection initialization can be simplified"
  192. dotnet_diagnostic.IDE0028.severity = none
  193. dotnet_diagnostic.IDE0300.severity = none
  194. dotnet_diagnostic.IDE0301.severity = none
  195. dotnet_diagnostic.IDE0302.severity = none
  196. dotnet_diagnostic.IDE0305.severity = none
  197. # Disable "'new' expression can be simplified"
  198. dotnet_diagnostic.IDE0090.severity = none
  199. # Disable "Use primary constructor"
  200. dotnet_diagnostic.IDE0290.severity = none
  201. # Disable "Member '' does not access instance data and can be marked as static"
  202. dotnet_diagnostic.CA1822.severity = none
  203. # Disable "Change type of field '' from '' to '' for improved performance"
  204. dotnet_diagnostic.CA1859.severity = none
  205. # Disable "Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array"
  206. dotnet_diagnostic.CA1861.severity = none
  207. # Disable "Prefer using 'string.Equals(string, StringComparison)' to perform a case-insensitive comparison, but keep in mind that this might cause subtle changes in behavior, so make sure to conduct thorough testing after applying the suggestion, or if culturally sensitive comparison is not required, consider using 'StringComparison.OrdinalIgnoreCase'"
  208. dotnet_diagnostic.CA1862.severity = none
  209. [src/Ryujinx.HLE/HOS/Services/**.cs]
  210. # Disable "mark members as static" rule for services
  211. dotnet_diagnostic.CA1822.severity = none
  212. [src/Ryujinx.Ava/UI/ViewModels/**.cs]
  213. # Disable "mark members as static" rule for ViewModels
  214. dotnet_diagnostic.CA1822.severity = none
  215. [src/Ryujinx.Tests/Cpu/*.cs]
  216. # Disable naming rules for CPU tests
  217. dotnet_diagnostic.IDE1006.severity = none