.editorconfig 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. # EditorConfig is awesome:http://EditorConfig.org
  2. # From https://raw.githubusercontent.com/dotnet/roslyn/master/.editorconfig
  3. # top-most EditorConfig file
  4. root = true
  5. # Don't use tabs for indentation.
  6. [*]
  7. indent_style = space
  8. # (Please don't specify an indent_size here; that has too many unintended consequences.)
  9. # Code files
  10. [*.{cs,csx,vb,vbx}]
  11. indent_size = 4
  12. insert_final_newline = true
  13. charset = utf-8-bom
  14. # Xml project files
  15. [*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
  16. indent_size = 2
  17. # Xml config files
  18. [*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
  19. indent_size = 2
  20. # Yml/Yaml files
  21. [*.{yaml,yml}]
  22. indent_size = 2
  23. # JSON files
  24. [*.json]
  25. indent_size = 2
  26. # Shell scripts
  27. [*.sh]
  28. end_of_line = lf
  29. [*.{cmd,bat}]
  30. end_of_line = crlf
  31. # Dotnet code style settings:
  32. [*.{cs,vb}]
  33. # Sort using and Import directives with System.* appearing first
  34. dotnet_sort_system_directives_first = true
  35. # Put a blank line between System.* and Microsoft.*
  36. dotnet_separate_import_directive_groups = true
  37. # Avoid "this." and "Me." if not necessary
  38. dotnet_style_qualification_for_field = false:suggestion
  39. dotnet_style_qualification_for_property = false:suggestion
  40. dotnet_style_qualification_for_method = false:suggestion
  41. dotnet_style_qualification_for_event = false:suggestion
  42. # Use language keywords instead of framework type names for type references
  43. dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
  44. dotnet_style_predefined_type_for_member_access = true:suggestion
  45. # Prefer read-only on fields
  46. dotnet_style_readonly_field = true:warning
  47. # Suggest more modern language features when available
  48. dotnet_style_object_initializer = true:suggestion
  49. dotnet_style_collection_initializer = true:suggestion
  50. dotnet_style_coalesce_expression = true:suggestion
  51. dotnet_style_null_propagation = true:suggestion
  52. dotnet_style_explicit_tuple_names = true:suggestion
  53. dotnet_style_prefer_inferred_tuple_names = true:suggestion
  54. dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
  55. dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
  56. dotnet_style_prefer_conditional_expression_over_return = false
  57. dotnet_style_prefer_conditional_expression_over_assignment = false
  58. dotnet_style_prefer_auto_properties = true
  59. # Accessibility modifiers
  60. dotnet_style_require_accessibility_modifiers = always:suggestion
  61. # Naming Rules
  62. # Interfaces start with an I and are PascalCased
  63. dotnet_naming_rule.interfaces_must_be_pascal_cased_and_prefixed_with_I.symbols = interface_symbols
  64. dotnet_naming_rule.interfaces_must_be_pascal_cased_and_prefixed_with_I.style = pascal_case_and_prefix_with_I_style
  65. dotnet_naming_rule.interfaces_must_be_pascal_cased_and_prefixed_with_I.severity = warning
  66. # External members are PascalCased
  67. dotnet_naming_rule.externally_visible_members_must_be_pascal_cased.symbols = externally_visible_symbols
  68. dotnet_naming_rule.externally_visible_members_must_be_pascal_cased.style = pascal_case_style
  69. dotnet_naming_rule.externally_visible_members_must_be_pascal_cased.severity = warning
  70. # Parameters are camelCased
  71. dotnet_naming_rule.parameters_must_be_camel_cased.symbols = parameter_symbols
  72. dotnet_naming_rule.parameters_must_be_camel_cased.style = camel_case_style
  73. dotnet_naming_rule.parameters_must_be_camel_cased.severity = warning
  74. # Constants are PascalCased
  75. dotnet_naming_rule.constants_must_be_pascal_cased.symbols = constant_symbols
  76. dotnet_naming_rule.constants_must_be_pascal_cased.style = pascal_case_style
  77. dotnet_naming_rule.constants_must_be_pascal_cased.severity = warning
  78. # Uncomment this group and comment out the next group if you prefer s_ prefixes for static fields
  79. # Private static fields are prefixed with s_ and are camelCased like s_myStatic
  80. #dotnet_naming_rule.private_static_fields_must_be_camel_cased_and_prefixed_with_s_underscore.symbols = private_static_field_symbols
  81. #dotnet_naming_rule.private_static_fields_must_be_camel_cased_and_prefixed_with_s_underscore.style = camel_case_and_prefix_with_s_underscore_style
  82. #dotnet_naming_rule.private_static_fields_must_be_camel_cased_and_prefixed_with_s_underscore.severity = warning
  83. # Static readonly fields are PascalCased
  84. dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.symbols = private_static_readonly_field_symbols
  85. dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.style = pascal_case_style
  86. dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.severity = warning
  87. # Comment this group and uncomment out the next group if you don't want _ prefixed fields.
  88. # Private instance fields are camelCased with an _ like _myField
  89. dotnet_naming_rule.private_instance_fields_must_be_camel_cased_and_prefixed_with_underscore.symbols = private_field_symbols
  90. dotnet_naming_rule.private_instance_fields_must_be_camel_cased_and_prefixed_with_underscore.style = camel_case_and_prefix_with_underscore_style
  91. dotnet_naming_rule.private_instance_fields_must_be_camel_cased_and_prefixed_with_underscore.severity = warning
  92. # Private instance fields are camelCased
  93. #dotnet_naming_rule.private_instance_fields_must_be_camel_cased.symbols = private_field_symbols
  94. #dotnet_naming_rule.private_instance_fields_must_be_camel_cased.style = camel_case_style
  95. #dotnet_naming_rule.private_instance_fields_must_be_camel_cased.severity = warning
  96. # Symbols
  97. dotnet_naming_symbols.externally_visible_symbols.applicable_kinds = class,struct,interface,enum,property,method,field,event,delegate
  98. dotnet_naming_symbols.externally_visible_symbols.applicable_accessibilities = public,internal,friend,protected,protected_internal,protected_friend,private_protected
  99. dotnet_naming_symbols.interface_symbols.applicable_kinds = interface
  100. dotnet_naming_symbols.interface_symbols.applicable_accessibilities = *
  101. dotnet_naming_symbols.parameter_symbols.applicable_kinds = parameter
  102. dotnet_naming_symbols.parameter_symbols.applicable_accessibilities = *
  103. dotnet_naming_symbols.constant_symbols.applicable_kinds = field
  104. dotnet_naming_symbols.constant_symbols.required_modifiers = const
  105. dotnet_naming_symbols.constant_symbols.applicable_accessibilities = *
  106. dotnet_naming_symbols.private_static_field_symbols.applicable_kinds = field
  107. dotnet_naming_symbols.private_static_field_symbols.required_modifiers = static,shared
  108. dotnet_naming_symbols.private_static_field_symbols.applicable_accessibilities = private
  109. dotnet_naming_symbols.private_static_readonly_field_symbols.applicable_kinds = field
  110. dotnet_naming_symbols.private_static_readonly_field_symbols.required_modifiers = static,shared,readonly
  111. dotnet_naming_symbols.private_static_readonly_field_symbols.applicable_accessibilities = private
  112. dotnet_naming_symbols.private_field_symbols.applicable_kinds = field
  113. dotnet_naming_symbols.private_field_symbols.applicable_accessibilities = private
  114. # Styles
  115. dotnet_naming_style.camel_case_style.capitalization = camel_case
  116. dotnet_naming_style.pascal_case_style.capitalization = pascal_case
  117. dotnet_naming_style.camel_case_and_prefix_with_s_underscore_style.required_prefix = s_
  118. dotnet_naming_style.camel_case_and_prefix_with_s_underscore_style.capitalization = camel_case
  119. dotnet_naming_style.camel_case_and_prefix_with_underscore_style.required_prefix = _
  120. dotnet_naming_style.camel_case_and_prefix_with_underscore_style.capitalization = camel_case
  121. dotnet_naming_style.pascal_case_and_prefix_with_I_style.required_prefix = I
  122. dotnet_naming_style.pascal_case_and_prefix_with_I_style.capitalization = pascal_case
  123. # CSharp code style settings:
  124. [*.cs]
  125. # Indentation preferences
  126. csharp_indent_block_contents = true
  127. csharp_indent_braces = false
  128. csharp_indent_case_contents = true
  129. csharp_indent_switch_labels = true
  130. csharp_indent_labels = flush_left
  131. # Prefer "var" everywhere
  132. csharp_style_var_for_built_in_types = true:suggestion
  133. csharp_style_var_when_type_is_apparent = true:suggestion
  134. csharp_style_var_elsewhere = true:suggestion
  135. # Code style defaults
  136. csharp_preserve_single_line_blocks = true
  137. csharp_preserve_single_line_statements = true
  138. # Prefer method-like constructs to have a block body
  139. csharp_style_expression_bodied_methods = false:none
  140. csharp_style_expression_bodied_constructors = false:none
  141. csharp_style_expression_bodied_operators = false:none
  142. # Prefer property-like constructs to have an expression-body
  143. csharp_style_expression_bodied_properties = true:none
  144. csharp_style_expression_bodied_indexers = true:none
  145. csharp_style_expression_bodied_accessors = true:none
  146. # Expression
  147. csharp_prefer_simple_default_expression = true:suggestion
  148. csharp_style_deconstructed_variable_declaration = true:suggestion
  149. csharp_style_pattern_local_over_anonymous_function = true:suggestion
  150. # Pattern matching
  151. csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
  152. csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
  153. csharp_style_inlined_variable_declaration = true:suggestion
  154. # Null checking preferences
  155. csharp_style_throw_expression = true:suggestion
  156. csharp_style_conditional_delegate_call = true:suggestion
  157. # Newline settings
  158. csharp_new_line_before_open_brace = all
  159. csharp_new_line_before_else = true
  160. csharp_new_line_before_catch = true
  161. csharp_new_line_before_finally = true
  162. csharp_new_line_before_members_in_object_initializers = true
  163. csharp_new_line_before_members_in_anonymous_types = true
  164. csharp_new_line_between_query_expression_clauses = true
  165. # Space preferences
  166. csharp_space_after_cast = false
  167. csharp_space_after_colon_in_inheritance_clause = true
  168. csharp_space_after_comma = true
  169. csharp_space_after_dot = false
  170. csharp_space_after_keywords_in_control_flow_statements = true
  171. csharp_space_after_semicolon_in_for_statement = true
  172. csharp_space_around_binary_operators = before_and_after
  173. csharp_space_around_declaration_statements = do_not_ignore
  174. csharp_space_before_colon_in_inheritance_clause = true
  175. csharp_space_before_comma = false
  176. csharp_space_before_dot = false
  177. csharp_space_before_open_square_brackets = false
  178. csharp_space_before_semicolon_in_for_statement = false
  179. csharp_space_between_empty_square_brackets = false
  180. csharp_space_between_method_call_empty_parameter_list_parentheses = false
  181. csharp_space_between_method_call_name_and_opening_parenthesis = false
  182. csharp_space_between_method_call_parameter_list_parentheses = false
  183. csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
  184. csharp_space_between_method_declaration_name_and_open_parenthesis = false
  185. csharp_space_between_method_declaration_parameter_list_parentheses = false
  186. csharp_space_between_parentheses = false
  187. csharp_space_between_square_brackets = false