.editorconfig 12 KB

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