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.

160 lines
9.2 KiB

  1. # editorconfig.org
  2. # Mostly based on https://github.com/dotnet/corefx/blob/master/.editorconfig
  3. # References
  4. # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017
  5. # https://kent-boogaart.com/blog/editorconfig-reference-for-c-developers
  6. # top-most EditorConfig file
  7. root = true
  8. # Default settings:
  9. # A newline ending every file
  10. # Use 4 spaces as indentation
  11. [*]
  12. insert_final_newline = true
  13. indent_style = space
  14. indent_size = 4
  15. charset = utf-8
  16. end_of_line = crlf
  17. trim_trailing_whitespace = true
  18. # Powershell files (build.ps1)
  19. [*.ps1]
  20. charset = utf-8-bom
  21. # Xml config files
  22. [*.{props,targets,config,nuspec,manifest}]
  23. indent_size = 2
  24. # Javascript Files
  25. [*.js]
  26. curly_bracket_next_line = true
  27. indent_brace_style = Allman
  28. # C++ Files
  29. [*.{cpp,h,in}]
  30. curly_bracket_next_line = true
  31. indent_brace_style = Allman
  32. [*.cs]
  33. # Capitalization styles
  34. dotnet_naming_style.constant_field_case_style.capitalization = pascal_case
  35. dotnet_naming_style.property_case_style.capitalization = pascal_case
  36. dotnet_naming_style.static_field_case_style.capitalization = pascal_case
  37. dotnet_naming_style.private_internal_field_case_style.capitalization = camel_case
  38. # New line preferences
  39. csharp_new_line_before_open_brace = all
  40. csharp_new_line_before_else = true
  41. csharp_new_line_before_catch = true
  42. csharp_new_line_before_finally = true
  43. csharp_new_line_before_members_in_object_initializers = true
  44. csharp_new_line_before_members_in_anonymous_types = true
  45. csharp_new_line_between_query_expression_clauses = true
  46. # Indentation preferences
  47. csharp_indent_block_contents = true
  48. csharp_indent_braces = false
  49. csharp_indent_case_contents = true
  50. csharp_indent_case_contents_when_block = false
  51. csharp_indent_switch_labels = true
  52. csharp_indent_labels = one_less_than_current
  53. # this.
  54. dotnet_style_qualification_for_field = false : suggestion
  55. dotnet_style_qualification_for_property = false : suggestion
  56. dotnet_style_qualification_for_method = false : suggestion
  57. dotnet_style_qualification_for_event = false : suggestion
  58. # Prefer using var
  59. csharp_style_var_for_built_in_types = true : none
  60. csharp_style_var_when_type_is_apparent = true : suggestion
  61. csharp_style_var_elsewhere = true : suggestion
  62. # use language keywords instead of BCL types
  63. dotnet_style_predefined_type_for_locals_parameters_members = true : suggestion
  64. dotnet_style_predefined_type_for_member_access = true : suggestion
  65. # Constant fields
  66. dotnet_naming_rule.constant_field_style.severity = error
  67. dotnet_naming_rule.constant_field_style.symbols = constant_field_target
  68. dotnet_naming_rule.constant_field_style.style = constant_field_case_style
  69. dotnet_naming_symbols.constant_field_target.applicable_kinds = field
  70. dotnet_naming_symbols.constant_field_target.required_modifiers = const
  71. # Properties
  72. dotnet_naming_rule.property_style.severity = error
  73. dotnet_naming_rule.property_style.symbols = property_target
  74. dotnet_naming_rule.property_style.style = property_case_style
  75. dotnet_naming_symbols.property_target.applicable_kinds = property
  76. dotnet_naming_symbols.property_target.required_modifiers = *
  77. # Static fields
  78. dotnet_naming_rule.static_field_style.severity = error
  79. dotnet_naming_rule.static_field_style.symbols = static_field_target
  80. dotnet_naming_rule.static_field_style.style = static_field_case_style
  81. dotnet_naming_symbols.static_field_target.applicable_kinds = field
  82. dotnet_naming_symbols.static_field_target.required_modifiers = static
  83. # Private and internal fields
  84. dotnet_naming_rule.private_internal_field_style.severity = error
  85. dotnet_naming_rule.private_internal_field_style.symbols = private_internal_field_target
  86. dotnet_naming_rule.private_internal_field_style.style = private_internal_field_case_style
  87. dotnet_naming_symbols.private_internal_field_target.applicable_kinds = field
  88. dotnet_naming_symbols.private_internal_field_target.applicable_accessibilities = private, internal
  89. # Code style defaults
  90. dotnet_sort_system_directives_first = true
  91. csharp_preserve_single_line_blocks = true
  92. csharp_prefer_braces = true
  93. csharp_preserve_single_line_statements = false
  94. dotnet_style_prefer_auto_properties = true : suggestion
  95. # Expression-level preferences
  96. dotnet_style_object_initializer = true : suggestion
  97. dotnet_style_collection_initializer = true : suggestion
  98. dotnet_style_explicit_tuple_names = false : suggestion
  99. dotnet_style_coalesce_expression = false : suggestion
  100. dotnet_style_null_propagation = false : suggestion
  101. # Expression-bodied members
  102. csharp_style_expression_bodied_methods = false : none
  103. csharp_style_expression_bodied_constructors = false : none
  104. csharp_style_expression_bodied_operators = false : none
  105. csharp_style_expression_bodied_properties = false : none
  106. csharp_style_expression_bodied_indexers = false : none
  107. csharp_style_expression_bodied_accessors = false : none
  108. # Space preferences
  109. csharp_space_after_cast = false
  110. csharp_space_after_colon_in_inheritance_clause = true
  111. csharp_space_after_comma = true
  112. csharp_space_after_dot = false
  113. csharp_space_after_keywords_in_control_flow_statements = true
  114. csharp_space_after_semicolon_in_for_statement = true
  115. csharp_space_around_binary_operators = before_and_after
  116. csharp_space_around_declaration_statements = do_not_ignore
  117. csharp_space_before_colon_in_inheritance_clause = true
  118. csharp_space_before_comma = false
  119. csharp_space_before_dot = false
  120. csharp_space_before_open_square_brackets = false
  121. csharp_space_before_semicolon_in_for_statement = false
  122. csharp_space_between_empty_square_brackets = false
  123. csharp_space_between_method_call_empty_parameter_list_parentheses = false
  124. csharp_space_between_method_call_name_and_opening_parenthesis = false
  125. csharp_space_between_method_call_parameter_list_parentheses = false
  126. csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
  127. csharp_space_between_method_declaration_name_and_open_parenthesis = false
  128. csharp_space_between_method_declaration_parameter_list_parentheses = false
  129. csharp_space_between_parentheses = false
  130. csharp_space_between_square_brackets = false
  131. # Modifier order
  132. csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async : error
  133. # CA2247: Argument passed to TaskCompletionSource constructor should be TaskCreationOptions enum instead of TaskContinuationOptions enum
  134. dotnet_diagnostic.CA2247.severity = error